Vuo
0.4.6
|
VuoHeap implementation.
Functions | |
void | sendErrorWrapper (const char *message) |
Calls the sendError() function defined in VuoRuntime (without introducing a direct dependency on VuoRuntime). | |
void | finalizeReferenceCounts (void) |
Cleans up the reference-counting system. | |
int | vuoRegisterF (const void *heapPointer, DeallocateFunctionType deallocate, const char *file, unsigned int line, const char *func) |
Instead of this function, you probably want to use vuoRegister . | |
int | vuoRetain (const void *heapPointer) |
Increments the reference count for heapPointer (unless heapPointer is not being reference-counted). | |
int | vuoRelease (const void *heapPointer) |
Decrements the reference count for heapPointer (unless heapPointer is not being reference-counted). | |
Variables | |
map< const void *, int > | referenceCounts |
The reference count for each pointer. | |
map< const void *, DeallocateFunctionType > | deallocateFunctions |
The function to be used for deallocating each pointer. | |
map< const void *, string > | descriptions |
A human-readable description for each pointer. | |
dispatch_semaphore_t | referenceCountsSemaphore = NULL |
Synchronizes access to referenceCounts . | |
void finalizeReferenceCounts | ( | void | ) |
Cleans up the reference-counting system.
To be called once, after all other reference-counting function calls.
int vuoRegisterF | ( | const void * | heapPointer, |
DeallocateFunctionType | deallocate, | ||
const char * | file, | ||
unsigned int | line, | ||
const char * | func | ||
) |
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. |
line | The line in the file in which vuoRegister is called. |
func | The function in which vuoRegister is called. |
heapPointer
. This is 0 if heapPointer
is not already being reference-counted, greater than 0 if it is, or -1 if heapPointer
is null. int vuoRelease | ( | const void * | heapPointer | ) |
Decrements the reference count for heapPointer
(unless heapPointer
is not being reference-counted).
If the reference count becomes 0, heapPointer
is deallocated and is no longer reference-counted.
heapPointer | A pointer to allocated memory on the heap. |
heapPointer
, or -1 if heapPointer
is not being reference-counted, has never been retained, or is null. int vuoRetain | ( | const void * | heapPointer | ) |
Increments the reference count for heapPointer
(unless heapPointer
is not being reference-counted).
heapPointer | A pointer to allocated memory on the heap. |
heapPointer
, or -1 if heapPointer
is not being reference-counted or is null.