Vuo
0.9.1
|
VuoHeap implementation.
Functions | |
void | sendErrorWrapper (const char *message) |
Calls the sendError() function defined in VuoRuntime (without introducing a direct dependency on VuoRuntime). | |
static void | VuoHeap_makeSafePointerSummary (char *summary, const void *pointer) |
Copies the first 16 printable characters of pointer into summary , followed by char 0. | |
void | VuoHeap_init (void) |
Initializes the reference-counting system. | |
void | VuoHeap_fini (void) |
Cleans up the reference-counting system. | |
int | VuoRegisterF (const void *heapPointer, DeallocateFunctionType deallocate, const char *file, unsigned int line, const char *func, const char *pointerName) |
Instead of this function, you probably want to use VuoRegister(). | |
int | VuoRegisterSingletonF (const void *heapPointer, const char *file, unsigned int line, const char *func, const char *pointerName) |
Instead of this function, you probably want to use VuoRegisterSingleton(). | |
int | VuoRetainF (const void *heapPointer, const char *file, unsigned int line, const char *func) |
Instead of this function, you probably want to use VuoRetain(). | |
int | VuoReleaseF (const void *heapPointer, const char *file, unsigned int line, const char *func) |
Instead of this function, you probably want to use VuoRelease(). | |
const 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. | |
Variables | |
map< const void *, int > | referenceCounts |
The reference count for each pointer. | |
static set< const void * > | singletons |
Known singleton pointers. | |
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 sendErrorWrapper | ( | const char * | message | ) |
Calls the sendError() function defined in VuoRuntime (without introducing a direct dependency on VuoRuntime).
void VuoHeap_fini | ( | void | ) |
Cleans up the reference-counting system.
To be called once, after all other reference-counting function calls.
const 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 returned string is still owned by VuoHeap; you should not free it.
void VuoHeap_init | ( | void | ) |
Initializes the reference-counting system.
To be called once, before any other reference-counting function calls.
|
static |
Copies the first 16 printable characters of pointer
into summary
, followed by char 0.
int VuoRegisterF | ( | const void * | heapPointer, |
DeallocateFunctionType | deallocate, | ||
const char * | file, | ||
unsigned int | line, | ||
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. |
line | The line in the file in which VuoRegister() is called. |
func | The function in which VuoRegister() is called. |
pointerName | The stringified pointer variable name. |
int VuoRegisterSingletonF | ( | const void * | heapPointer, |
const char * | file, | ||
unsigned int | line, | ||
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.
int VuoReleaseF | ( | const void * | heapPointer, |
const char * | file, | ||
unsigned int | line, | ||
const char * | func | ||
) |
Instead of this function, you probably want to use VuoRelease().
This function is used to implement the VuoRelease() macro.
int VuoRetainF | ( | const void * | heapPointer, |
const char * | file, | ||
unsigned int | line, | ||
const char * | func | ||
) |
Instead of this function, you probably want to use VuoRetain().
This function is used to implement the VuoRetain() macro.
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.
map<const void *, int> referenceCounts |
The reference count for each pointer.
dispatch_semaphore_t referenceCountsSemaphore = NULL |
Synchronizes access to referenceCounts.
|
static |
Known singleton pointers.