VuoHeap interface.
Definition in file VuoHeap.h.
Go to the source code of this file.
Macros | |
#define | VuoRegister(heapPointer, deallocate) |
Registers heapPointer to be reference-counted and stores its deallocate function (unless heapPointer is null or is already being reference-counted). More... | |
#define | VuoRegisterSingleton(heapPointer) |
Registers heapPointer as a singleton, meaning that VuoRetain and VuoRelease will have no effect on it (and will not issue warnings). More... | |
#define | VuoLocal(heapPointer) |
Immediately retains heapPointer , and automatically releases it at the end of the local scope. More... | |
#define | VuoWarnUnusedResult __attribute__((warn_unused_result)) |
Append this to function declarations to ensure that the caller uses/checks the return value. More... | |
#define | VuoIgnoreResult(a) (void)a |
Wrap function invocations with this to indicate that the return value is intentionally ignored. More... | |
Typedefs | |
typedef void(* | DeallocateFunctionType) (void *) |
A type for destructor functions, such as free(void *) , which are used to deallocate reference-counted memory when it's no longer in use. More... | |
Functions | |
void | VuoHeap_report (void) |
Sends a telemetry error with information about any objects remaining in the reference counting table. More... | |
int | VuoRegisterF (const void *heapPointer, DeallocateFunctionType deallocate, const char *file, unsigned int linenumber, const char *func, const char *pointerName) |
Instead of this function, you probably want to use VuoRegister(). More... | |
int | VuoRegisterSingletonF (const void *heapPointer, const char *file, unsigned int linenumber, const char *func, const char *pointerName) |
Instead of this function, you probably want to use VuoRegisterSingleton(). More... | |
int | VuoRetain (const void *heapPointer) |
Increments the reference count for heapPointer (unless heapPointer is not being reference-counted). More... | |
int | VuoRelease (const void *heapPointer) |
Decrements the reference count for heapPointer (unless heapPointer is not being reference-counted). More... | |
bool | VuoHeap_isPointerReadable (const void *pointer) |
Returns true if pointer points to a memory page that's been allocated (and therefore might be a valid pointer to 1 or more bytes of data). More... | |
char * | VuoHeap_getDescription (const void *heapPointer) |
Returns a description of the specified heapPointer: the file, line, and function where VuoRegister() was called, and the variable name. More... | |
void | VuoHeap_addTrace (const void *heapPointer) |
Pass a pointer to this function to log all its subsequent retains and releases. More... | |
#define VuoIgnoreResult | ( | a | ) | (void)a |
Wrap function invocations with this to indicate that the return value is intentionally ignored.
#define VuoWarnUnusedResult __attribute__((warn_unused_result)) |
Append this to function declarations to ensure that the caller uses/checks the return value.
void VuoHeap_addTrace | ( | const void * | heapPointer | ) |
Pass a pointer to this function to log all its subsequent retains and releases.
This only has an effect when CMake option VUO_HEAP_TRACE
is enabled.
Definition at line 641 of file VuoHeap.cc.
char * VuoHeap_getDescription | ( | const void * | heapPointer | ) |
Returns a description of the specified heapPointer: the file, line, and function where VuoRegister() was called, and the variable name.
The caller is responsible for freeing the returned string.
Definition at line 618 of file VuoHeap.cc.
bool VuoHeap_isPointerReadable | ( | const void * | pointer | ) |
Returns true if pointer
points to a memory page that's been allocated (and therefore might be a valid pointer to 1 or more bytes of data).
Definition at line 130 of file VuoHeap.cc.
void VuoHeap_report | ( | void | ) |
Sends a telemetry error with information about any objects remaining in the reference counting table.
Definition at line 242 of file VuoHeap.cc.
int VuoRegisterF | ( | const void * | heapPointer, |
DeallocateFunctionType | deallocate, | ||
const char * | file, | ||
unsigned int | linenumber, | ||
const char * | func, | ||
const char * | pointerName | ||
) |
Instead of this function, you probably want to use VuoRegister().
This function is used to implement the VuoRegister() macro.
Registers heapPointer to be reference-counted and stores its deallocate function (unless heapPointer is null or is already being reference-counted).
heapPointer | A pointer to allocated memory on the heap. |
deallocate | The function to be used to deallocate the memory when the reference count gets back to its original value of 0. |
file | The name of the file in which VuoRegister() is called. |
linenumber | The line in the file in which VuoRegister() is called. |
func | The function in which VuoRegister() is called. |
pointerName | The stringified pointer variable name. |
Definition at line 281 of file VuoHeap.cc.
int VuoRegisterSingletonF | ( | const void * | heapPointer, |
const char * | file, | ||
unsigned int | linenumber, | ||
const char * | func, | ||
const char * | pointerName | ||
) |
Instead of this function, you probably want to use VuoRegisterSingleton().
This function is used to implement the VuoRegisterSingleton() macro.
Definition at line 355 of file VuoHeap.cc.