CACAO
|
Dump memory block. More...
Public Member Functions | |
DumpMemoryBlock (size_t size=0) | |
Checks canaries in this dump memory area. More... | |
~DumpMemoryBlock () | |
Release the memory block for the dump memory block. More... | |
size_t | get_size () const |
size_t | get_used () const |
size_t | get_free () const |
void * | allocate (size_t size) |
Allocate memory in the current dump memory area. More... | |
Private Attributes | |
size_t | _size |
Size of the current memory block. More... | |
size_t | _used |
Used memory in the current memory block. More... | |
void * | _block |
List of memory blocks in this area. More... | |
Static Private Attributes | |
static const size_t | DEFAULT_SIZE = 2 << 13 |
Dump memory block.
Definition at line 122 of file dumpmemory.hpp.
DumpMemoryBlock::DumpMemoryBlock | ( | size_t | size = 0 | ) |
Checks canaries in this dump memory area.
If any canary has been changed, this function aborts the VM with an error message. Allocate a memory block for the current dump memory block.
size | Required memory size. |
Definition at line 242 of file dumpmemory.cpp.
DumpMemoryBlock::~DumpMemoryBlock | ( | ) |
Release the memory block for the dump memory block.
size | Required memory size. |
Definition at line 262 of file dumpmemory.cpp.
|
inline |
Allocate memory in the current dump memory area.
This function is a fast allocator suitable for scratch memory that can be collectively freed when the current activity (eg. compiling) is done.
You cannot selectively free dump memory. Before you start allocating it, you remember the current size returned by dumpmemory_marker
. Later, when you no longer need the memory, call dumpmemory_release
with the remembered size and all dump memory allocated since the call to dumpmemory_marker
will be freed.
size Size of block to allocate in bytes. May be zero, in which case NULL is returned
Definition at line 351 of file dumpmemory.hpp.
|
inline |
Definition at line 136 of file dumpmemory.hpp.
|
inline |
Definition at line 134 of file dumpmemory.hpp.
|
inline |
Definition at line 135 of file dumpmemory.hpp.
|
private |
List of memory blocks in this area.
Definition at line 128 of file dumpmemory.hpp.
|
private |
Size of the current memory block.
Definition at line 126 of file dumpmemory.hpp.
|
private |
Used memory in the current memory block.
Definition at line 127 of file dumpmemory.hpp.
|
staticprivate |
Definition at line 124 of file dumpmemory.hpp.