API Reference | developer.brewmp.com API Reference | developer.brewmp.com

Developer

API Reference

IREALLOC

Brew Release
Brew MP 1.0.2
See Also
IEnv interface (derived from IRealloc)
Description
IRealloc is an interface to a pool of memory available for dynamic allocation (a "heap").
Usage
IRealloc implements four methods; all have the same basic functionality, but differ in whether they associate a "debug name" with the requested memory block and in whether they guarantee newly allocated memory to be zero-filled.
The basic functionality is similar to the standard C library realloc() function. A new allocation is done by reallocating a NULL pointer to the desired size. Freeing an allocated block is done by reallocating the block to size zero (0). Convenience methods are provided for these simple operations which are roughly equivalent to malloc() and free().
Note that reallocating a NULL pointer to size zero (0) is explicitly allowed and causes no action to be taken.
For those methods which associate a "debug name" with the requested memory block, the name is a zero-terminated character string. The name will be copied by the implementation, so the caller may free or re-use the memory immediately after the IRealloc method finishes. Heap implementations may silently drop, truncate, or otherwise modify debug names, but for those heap implementations which are capable of providing debug output, including the accurate debug name in the output provides valuable context for the developer.