Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qmemory_resource_tlsf_p.h
Go to the documentation of this file.
1// Copyright (C) 2025 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QMEMORY_RESOURCE_TLSF_P_H
5#define QMEMORY_RESOURCE_TLSF_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtMultimedia/private/q_pmr_emulation_p.h>
19#include <QtMultimedia/qtmultimediaglobal.h>
20#include <QtCore/qtclasshelpermacros.h>
21
22#include <new>
23
24QT_BEGIN_NAMESPACE
25
26namespace QtPrivate {
27typedef void *tlsf_t;
28}
29
30namespace QtMultimediaPrivate {
31
33{
37
39
42
43private:
44 void *do_allocate(size_t bytes, size_t alignment) override;
45 void do_deallocate(void *p, size_t bytes, size_t alignment) override;
46 bool do_is_equal(const memory_resource &other) const noexcept override;
47
48 // cache line alignment on most platforms
49 static constexpr auto poolAlignment = std::align_val_t{ 128 };
50
51 QtPrivate::tlsf_t m_tlsf;
52 const size_t m_allocationSize;
53 std::byte *m_buffer = nullptr;
54 pmr::memory_resource *m_upstream{};
55};
56
57} // namespace QtMultimediaPrivate
58
59QT_END_NAMESPACE
60
61#endif // QMEMORY_RESOURCE_TLSF_P_H
void do_deallocate(void *p, size_t bytes, size_t alignment) override
void * do_allocate(size_t bytes, size_t alignment) override
bool do_is_equal(const memory_resource &other) const noexcept override
Q_MULTIMEDIA_EXPORT QTlsfMemoryResource(std::size_t preallocatedBytes, pmr::memory_resource *upstream=pmr::get_default_resource())