|
|
@@ -40,11 +40,14 @@
|
|
|
|
|
|
namespace bx
|
|
|
{
|
|
|
+ /// Abstract allocator interface.
|
|
|
+ ///
|
|
|
struct BX_NO_VTABLE AllocatorI
|
|
|
{
|
|
|
+ ///
|
|
|
virtual ~AllocatorI() = 0;
|
|
|
|
|
|
- /// Allocated, resizes memory block or frees memory.
|
|
|
+ /// Allocates, resizes memory block, or frees memory.
|
|
|
///
|
|
|
/// @param[in] _ptr If _ptr is NULL new block will be allocated.
|
|
|
/// @param[in] _size If _ptr is set, and _size is 0, memory will be freed.
|
|
|
@@ -64,7 +67,7 @@ namespace bx
|
|
|
, size_t _align = BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT
|
|
|
);
|
|
|
|
|
|
- ///
|
|
|
+ /// Allocate memory.
|
|
|
void* alloc(
|
|
|
AllocatorI* _allocator
|
|
|
, size_t _size
|
|
|
@@ -73,7 +76,7 @@ namespace bx
|
|
|
, uint32_t _line = 0
|
|
|
);
|
|
|
|
|
|
- ///
|
|
|
+ /// Free memory.
|
|
|
void free(
|
|
|
AllocatorI* _allocator
|
|
|
, void* _ptr
|
|
|
@@ -82,7 +85,7 @@ namespace bx
|
|
|
, uint32_t _line = 0
|
|
|
);
|
|
|
|
|
|
- ///
|
|
|
+ /// Resize memory block.
|
|
|
void* realloc(
|
|
|
AllocatorI* _allocator
|
|
|
, void* _ptr
|
|
|
@@ -92,7 +95,7 @@ namespace bx
|
|
|
, uint32_t _line = 0
|
|
|
);
|
|
|
|
|
|
- ///
|
|
|
+ /// Allocate memory with specific alignment.
|
|
|
void* alignedAlloc(
|
|
|
AllocatorI* _allocator
|
|
|
, size_t _size
|
|
|
@@ -101,7 +104,7 @@ namespace bx
|
|
|
, uint32_t _line = 0
|
|
|
);
|
|
|
|
|
|
- ///
|
|
|
+ /// Free memory that was allocated with aligned allocator.
|
|
|
void alignedFree(
|
|
|
AllocatorI* _allocator
|
|
|
, void* _ptr
|
|
|
@@ -110,7 +113,7 @@ namespace bx
|
|
|
, uint32_t _line = 0
|
|
|
);
|
|
|
|
|
|
- ///
|
|
|
+ /// Resize memory block that was allocated with aligned allocator.
|
|
|
void* alignedRealloc(
|
|
|
AllocatorI* _allocator
|
|
|
, void* _ptr
|
|
|
@@ -120,7 +123,7 @@ namespace bx
|
|
|
, uint32_t _line = 0
|
|
|
);
|
|
|
|
|
|
- ///
|
|
|
+ /// Delete object with specific allocator.
|
|
|
template <typename ObjectT>
|
|
|
void deleteObject(
|
|
|
AllocatorI* _allocator
|