This is the documentation for Enlighten.
module Memory Allocation
Classes
Name | Description |
|---|---|
Simple implementation of the MemoryAllocator class that forwards all requests to the malloc/free ANSI functions. | |
MemoryAllocator implementation which fills allocated memory with a given value. | |
Fully featured MemoryAllocator implementation that handles memory tracking, leak detection, stack traces, reporting and more. | |
Implementation of the MemoryAllocator class (on Windows) that uses VirtualAlloc and VirtualProtect to provide similar memory overwrite detection as the Application Verifier. | |
Class used to override memory allocation and freeing. |
Functions
Name | Description |
|---|---|
Force a virtual destructor. This is not called by GeoMemory. | |
Allocate(size_t, size_t, const char *, Geo::s32, const char *) | Allocate a block of memory with the given size. |
Free a block of memory, possibly aligned. | |
Templated function equivalent of GEO_DELETE_ARRAY A handy template so you don't have to enter the type param (and potentially get it wrong) | |
Templated function equivalent of GEO_DELETE A handy template so you don't have to enter the type param (and potentially get it wrong) | |
Calls destructor on object. | |
Calls destructor on object. | |
Gets the currently set memory allocator, or NULL if none has been set yet. | |
The number of page faults that occurred during the process life. | |
The peak amount of memory allocated by the process. | |
The total amount of memory we've allocated to date (not subtracting deallocations). | |
The number of times we've allocated memory through GeoMemory. | |
The total amount of memory we've deallocated so far. | |
The total amount of memory currently allocated (allocations minus deallocations) | |
The total amount of memory currently allocated (allocations minus deallocations) | |
The total amount of memory currently allocated by the process. | |
Get the total amount of system physical memory. | |
Returns true if the memory summary functionality is supported with this allocator. | |
This will generate a report on memory leaks, and attempt to release the leaks. | |
PrintTotalMemorySummaryForMarker(const char *, const char *, s32) | Print a basic report to the LOG_INFO stream. |
Realloc(void *, size_t, size_t, const char *, s32, const char *) | Reallocate a block of memory, preserving as much data as will fit in the new block size. |
Scoped safe release function. | |
Set the memory allocator. |
Defines
Name | Description |
|---|---|
GEO_ALIGNED_FREE Geo::AlignedFree(mem, __FILE__, __LINE__, GEO_STRINGISE(mem)); (mem) = NULL | Free memory previously allocated by GEO_ALIGNED_MALLOC. |
GEO_ALIGNED_MALLOC Geo::AlignedMalloc(size, align, __FILE__, __LINE__, GEO_STRINGISE(size) " " GEO_STRINGISE(align)) | Allocate memory of a given size and alignment. |
GEO_ALIGNED_NEW (new (Geo::AlignedMalloc(sizeof(type), align, __FILE__, __LINE__, GEO_STRINGISE(type))) type) | do a parameterless new of a given type using GEO_MALLOC |
GEO_ALIGNED_NEW_ARGS (new (Geo::AlignedMalloc(sizeof(type), align, __FILE__, __LINE__, GEO_STRINGISE(type) " " GEO_STRINGISE(args))) type args) | do a parameterized new of a given type using GEO_MALLOC |
GEO_DELETE if (mem) { (mem)->~type(); Geo::AlignedFree(mem, __FILE__, __LINE__, GEO_STRINGISE(type) " " GEO_STRINGISE(mem)); (mem) = nullptr; } | delete an object previously allocated by GEO_NEW or GEO_NEW_ARGS |
GEO_DELETE_ARRAY Geo::DeleteArray<type>(mem, __FILE__, __LINE__, GEO_STRINGISE(type) " " GEO_STRINGISE(mem)) | delete an array previously allocated using GEO_NEW_ARRAY |
GEO_DELETE_NS if (mem) { (mem)->ns::type::~type(); Geo::AlignedFree(mem, __FILE__, __LINE__, GEO_STRINGISE(type) " " GEO_STRINGISE(mem)); (mem) = NULL; } | delete an object previously allocated by GEO_NEW or GEO_NEW_ARGS when the type requires a namespace specification |
GEO_DELETE_THIS this->~type(); Geo::AlignedFree(this, __FILE__, __LINE__, GEO_STRINGISE(type) " " GEO_STRINGISE(mem)) | delete the underlying object pointed to by the this pointer. |
GEO_FREE Geo::Free(mem, __FILE__, __LINE__, GEO_STRINGISE(mem)); (mem) = NULL | Free memory previously allocated by GEO_MALLOC. |
GEO_INPLACE_DELETE if (mem) { (mem)->~type(); (mem) = 0; } | do an inplace delete |
GEO_INPLACE_NEW (new (mem) type) | do a parameterless inplace new |
GEO_INPLACE_NEW_ARGS (new (mem) type args) | do a parameterized inplace new |
GEO_MALLOC Geo::Malloc(size, __FILE__, __LINE__, GEO_STRINGISE(size)) | Allocate memory of a given size. |
GEO_MEM_AUDIT_MARKER Geo::PrintTotalMemorySummaryForMarker(name, __FILE__, __LINE__) | Place an audit marker that will generate a basic summary of the overall memory using the GetTotalMemory*() functions. |
GEO_NEW (new (Geo::AlignedMalloc(sizeof(type), GEO_ALIGN_OF(type), __FILE__, __LINE__, GEO_STRINGISE(type))) type) | do a parameterless new of a given type using GEO_MALLOC |
GEO_NEW_ARGS (new (Geo::AlignedMalloc(sizeof(type), GEO_ALIGN_OF(type), __FILE__, __LINE__, GEO_STRINGISE(type) " " GEO_STRINGISE(args))) type args) | do a parameterized new of a given type using GEO_MALLOC |
GEO_NEW_ARRAY Geo::NewArray<type>(length, GEO_ALIGN_OF(type), __FILE__, __LINE__, GEO_STRINGISE(type) " " GEO_STRINGISE(length)) | allocate a new array using GEO_ALIGNED_MALLOC, using the alignment of the type being allocated |
GEO_NEW_ARRAY_ALIGNED Geo::NewArray<type>(length, align, __FILE__, __LINE__, GEO_STRINGISE(type) " " GEO_STRINGISE(length)) | allocate a new array using GEO_ALIGNED_MALLOC, using whatever alignment is specified |
GEO_REALLOC Geo::Realloc(mem, size, align, __FILE__, __LINE__, GEO_STRINGISE(mem)) | Implements 'realloc' functionality (resize a memory block, retaining the data values that fit in the new size). |
GEO_UNSAFE_DELETE if (mem) { (mem)->~type(); Geo::AlignedFree(mem, __FILE__, __LINE__, GEO_STRINGISE(type) " " GEO_STRINGISE(mem)); } | like GEO_DELETE, but does not zero the pointer |