3 #ifndef INCLUDE_NN_NLIB_HEAP_UNITHEAP_H_
4 #define INCLUDE_NN_NLIB_HEAP_UNITHEAP_H_
9 #if defined(_MSC_VER) && defined(nx_heap_EXPORTS)
10 #undef NLIB_VIS_PUBLIC
11 #define NLIB_VIS_PUBLIC NLIB_WINEXPORT
19 typedef void (*DestructorHandler)(
void* start,
void* end);
25 (*m_Handler)(m_Start, m_End);
28 errno_t Initialize(
void* start,
size_t size, DestructorHandler handler,
size_t unit,
30 void* Alloc() NLIB_NOEXCEPT;
31 errno_t Free(
void* p) NLIB_NOEXCEPT;
32 size_t GetUnitSize() const NLIB_NOEXCEPT {
return m_UnitSize; }
35 void Dump() NLIB_NOEXCEPT;
43 size_t m_BaseUnitCount;
46 size_t m_AllocatedCount;
48 uint32_t m_HeapOption;
51 DestructorHandler m_Handler;
57 #if defined(_MSC_VER) && defined(nx_heap_EXPORTS)
58 #undef NLIB_VIS_PUBLIC
59 #define NLIB_VIS_PUBLIC NLIB_WINIMPORT
62 #endif // INCLUDE_NN_NLIB_HEAP_UNITHEAP_H_
#define NLIB_NOEXCEPT
Defines noexcept geared to the environment, or the equivalent.
#define NLIB_FINAL
Defines final if it is available for use. If not, holds an empty string.
Heap for allocating and freeing fixed-size regions of memory. This is a so-called "pool-allocator...
size_t GetUnitCount() const noexcept
Returns the number of regions that can be allocated from this heap.
size_t GetAllocatedCount() const noexcept
Returns the number of regions that are currently allocated from this heap.
A file that contains the configuration information for each development environment.
Used when aligned memory needs to be obtained.