|
Bond 0.9
Bond Standard Library API Documentation
|
API for scope-based and manual dynamic memory management, as well as other memory related functions. More...
Classes | |
| struct | Bond::Collector |
| An opaque set of collected allocations that are freed together. More... | |
Functions | |
| Collector * | Bond::GetCollector () |
| Returns the Collector of the calling function. | |
| void * | Bond::Allocate (ulong size) |
| Allocates a block of memory that must be freed manually. | |
| void * | Bond::AllocateCollected (ulong size) |
| Allocates a block of memory that is freed automatically when the calling function returns. | |
| void * | Bond::AllocateWithCollector (Collector *collector, ulong size) |
| Allocates a block of memory that is freed automatically along with a given Collector. | |
| void * | Bond::AllocateAligned (ulong size, uint alignment) |
| Allocates an aligned block of memory that must be freed manually. | |
| void * | Bond::AllocateAlignedCollected (ulong size, uint alignment) |
| Allocates an aligned block of memory that is freed automatically when the calling function returns. | |
| void * | Bond::AllocateAlignedWithCollector (Collector *collector, ulong size, uint alignment) |
| Allocates an aligned block of memory that is freed automatically along with a given Collector. | |
| void | Bond::Free (void *ptr) |
| Frees a block of memory allocated with Allocate. | |
| void | Bond::FreeAligned (void *ptr) |
| Frees a block of memory allocated with AllocateAligned. | |
| void | Bond::Memcpy (void *dest, void *src, ulong size) |
| Copies bytes from one block of memory to another. The blocks must not overlap. | |
API for scope-based and manual dynamic memory management, as well as other memory related functions.
| void * Bond::Allocate | ( | ulong | size | ) |
Allocates a block of memory that must be freed manually.
| size | The size of the block in bytes. |
| void * Bond::AllocateAligned | ( | ulong | size, |
| uint | alignment ) |
Allocates an aligned block of memory that must be freed manually.
| size | The size of the block in bytes. |
| alignment | The alignment of the block in bytes. |
| void * Bond::AllocateAlignedCollected | ( | ulong | size, |
| uint | alignment ) |
Allocates an aligned block of memory that is freed automatically when the calling function returns.
| size | The size of the block in bytes. |
| alignment | The alignment of the block in bytes. |
| void * Bond::AllocateAlignedWithCollector | ( | Collector * | collector, |
| ulong | size, | ||
| uint | alignment ) |
Allocates an aligned block of memory that is freed automatically along with a given Collector.
| collector | The Collector with which the memory is registered. If null, the Collector of the calling function is used. |
| size | The size of the block in bytes. |
| alignment | The alignment of the block in bytes. |
| void * Bond::AllocateCollected | ( | ulong | size | ) |
Allocates a block of memory that is freed automatically when the calling function returns.
| size | The size of the block in bytes. |
| void * Bond::AllocateWithCollector | ( | Collector * | collector, |
| ulong | size ) |
Allocates a block of memory that is freed automatically along with a given Collector.
| collector | The Collector with which the memory is registered. If null, the Collector of the calling function is used. |
| size | The size of the block in bytes. |
| void Bond::Free | ( | void * | ptr | ) |
Frees a block of memory allocated with Allocate.
| ptr | A pointer returned by Allocate. |
| void Bond::FreeAligned | ( | void * | ptr | ) |
Frees a block of memory allocated with AllocateAligned.
| ptr | A pointer returned by AllocateAligned. |
| Collector * Bond::GetCollector | ( | ) |
Returns the Collector of the calling function.
Allocations registered with it are freed when the calling function returns. The returned pointer can be passed to a function that it calls, so that the callee can allocate memory that outlives it.
| void Bond::Memcpy | ( | void * | dest, |
| void * | src, | ||
| ulong | size ) |
Copies bytes from one block of memory to another. The blocks must not overlap.
| dest | A pointer to the memory into which the bytes are copied. |
| src | A pointer to the memory from which the bytes are copied. |
| size | The number of bytes to copy. Both pointers must be non-null unless it is 0. |