Heap provider.
More...
#include <base/mem/Heap.h>
Inherits HeapImpl.
|
static MemorySize | getMinimumSize () noexcept |
|
template<class TYPE > |
static TYPE * | allocateNoThrow (MemorySize size) noexcept |
|
template<class TYPE > |
static TYPE * | allocate (MemorySize size) |
|
template<class TYPE > |
static TYPE * | resize (TYPE *heap, MemorySize size) |
|
static bool | canResizeInplace () noexcept |
|
template<class TYPE > |
static TYPE * | tryResize (void *heap, MemorySize size) |
|
template<class TYPE > |
static void | release (TYPE *heap) |
|
template<class TYPE > |
static MemorySize | getSize (TYPE *heap) noexcept |
|
static void | onLeak (const Type *type, void *buffer, MemorySize size) |
|
static MemorySize | align64 (MemorySize offset) noexcept |
|
static MemorySize | align32 (MemorySize offset) noexcept |
|
static MemorySize | align16 (MemorySize offset) noexcept |
|
static MemorySize | align (MemorySize offset) noexcept |
|
Heap provider.
Heap. Wrapper for memory allocation on the heap.
- Version
- 1.0
◆ align()
static MemorySize Heap::align |
( |
MemorySize |
offset | ) |
|
|
inlinestaticnoexcept |
Adjusts offset to 16 bytes alignment.
◆ align16()
static MemorySize Heap::align16 |
( |
MemorySize |
offset | ) |
|
|
inlinestaticnoexcept |
Adjusts offset to 16 bytes alignment.
◆ align32()
static MemorySize Heap::align32 |
( |
MemorySize |
offset | ) |
|
|
inlinestaticnoexcept |
Adjusts offset to 32 bytes alignment.
◆ align64()
static MemorySize Heap::align64 |
( |
MemorySize |
offset | ) |
|
|
inlinestaticnoexcept |
Adjusts offset to 64 bytes alignment.
◆ allocate()
template<class TYPE >
static TYPE* Heap::allocate |
( |
MemorySize |
size | ) |
|
|
inlinestatic |
Allocates the specified number of bytes on the heap. Raises MemoryException if unable to allocate the memory block.
- Parameters
-
size | The desired size of the memory block in number of elements. |
◆ allocateNoThrow()
template<class TYPE >
static TYPE* Heap::allocateNoThrow |
( |
MemorySize |
size | ) |
|
|
inlinestaticnoexcept |
Allocates the specified number of bytes on the heap. Returns nullptr if unable to allocate the memory block.
- Parameters
-
size | The desired size of the memory block in number of elements. |
◆ canResizeInplace()
static bool Heap::canResizeInplace |
( |
| ) |
|
|
inlinestaticnoexcept |
Returns true if inplace reallocation is supported.
◆ getMinimumSize()
static MemorySize Heap::getMinimumSize |
( |
| ) |
|
|
inlinestaticnoexcept |
Returns the minimum block size.
◆ getSize()
template<class TYPE >
static MemorySize Heap::getSize |
( |
TYPE * |
heap | ) |
|
|
inlinestaticnoexcept |
Returns the size of the memory block.
- Parameters
-
◆ onLeak()
static void Heap::onLeak |
( |
const Type * |
type, |
|
|
void * |
buffer, |
|
|
MemorySize |
size |
|
) |
| |
|
static |
Called to register heap leaks.
◆ release()
template<class TYPE >
static void Heap::release |
( |
TYPE * |
heap | ) |
|
|
inlinestatic |
Frees the specified memory block previously allocated by 'allocate' or 'reallocate'. Raises MemoryException if unable to free the memory.
- Parameters
-
◆ resize()
template<class TYPE >
static TYPE* Heap::resize |
( |
TYPE * |
heap, |
|
|
MemorySize |
size |
|
) |
| |
|
inlinestatic |
Resizes the specified memory block. Raises MemoryException if unable allocate memory block.
- Parameters
-
heap | The memory block. |
size | The desired size of the memory block in number of elements. |
◆ tryResize()
template<class TYPE >
static TYPE* Heap::tryResize |
( |
void * |
heap, |
|
|
MemorySize |
size |
|
) |
| |
|
inlinestatic |
Tries to resize the specified memory block without movement. Raises MemoryException on allocation failure.
- Parameters
-
heap | The memory block. |
size | The desired size of the memory block in number of elements. |
- Returns
- nullptr if unable to resize memory block or size was 0.