Vuo
1.2.1
|
VuoHeap implementation.
Classes | |
struct | VuoHeapEntry |
An entry in the reference-counting table. More... | |
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. | |
static char * | VuoHeap_makeDescription (VuoHeapEntry e) |
Copies the first 16 printable characters of pointer into summary , followed by char 0. | |
static void | __attribute__ ((constructor(101))) VuoHeap_init() |
Initializes the reference-counting system. | |
void | VuoHeap_report (void) |
Sends a telemetry error with information about any objects remaining in the reference counting table. | |
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) |
Wrapper for VuoRetain. | |
int | VuoRetain (const void *heapPointer) |
Increments the reference count for heapPointer (unless heapPointer is not being reference-counted). | |
int | VuoReleaseF (const void *heapPointer, const char *file, unsigned int line, const char *func) |
Wrapper for VuoRelease. | |
int | VuoRelease (const void *heapPointer) |
Decrements the reference count for heapPointer (unless heapPointer is not being reference-counted). | |
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. | |
void | VuoHeap_addTrace (const void *heapPointer) |
Pass a pointer to this function to log all its subsequent retains and releases. | |
Variables | |
static set< const void * > * | VuoHeap_trace |
Heap pointers to trace. | |
static map< const void *, VuoHeapEntry > * | referenceCounts |
The reference count for each pointer. | |
static set< const void * > * | singletons |
Known singleton pointers. | |
static dispatch_semaphore_t | referenceCountsSemaphore = NULL |
Synchronizes access to referenceCounts. | |
struct VuoHeapEntry |
Class Members | ||
---|---|---|
DeallocateFunctionType | deallocateFunction | |
const char * | file | |
const char * | function | |
unsigned int | line | |
int | referenceCount | |
const char * | variable |
|
static |
Initializes the reference-counting system.
This function is automatically added near the beginning of the linker module's call graph.
void sendErrorWrapper | ( | const char * | message | ) |
Calls the sendError() function defined in VuoRuntime (without introducing a direct dependency on VuoRuntime).
void VuoHeap_addTrace | ( | const void * | heapPointer | ) |
Pass a pointer to this function to log all its subsequent retains and releases.
This only has any effect when preprocessor macro VUOHEAP_TRACE
is defined in VuoHeap.cc
.
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 caller is responsible for freeing the returned string.
|
static |
Copies the first 16 printable characters of pointer
into summary
, followed by char 0.
|
static |
Copies the first 16 printable characters of pointer
into summary
, followed by char 0.
void VuoHeap_report | ( | void | ) |
Sends a telemetry error with information about any objects remaining in the reference counting table.
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 | ||
) |
Wrapper for VuoRelease.
This used to be an instrumented function, but the instrumentation was removed in Vuo 1.2 to improve performance. It's still here so that plugins compiled with Vuo 0.9 through 1.1 have a better chance of linking successfully.
int VuoRetainF | ( | const void * | heapPointer, |
const char * | file, | ||
unsigned int | line, | ||
const char * | func | ||
) |
Wrapper for VuoRetain.
This used to be an instrumented function, but the instrumentation was removed in Vuo 1.2 to improve performance. It's still here so that plugins compiled with Vuo 0.9 through 1.1 have a better chance of linking successfully.
|
static |
The reference count for each pointer.
|
static |
Synchronizes access to referenceCounts.
|
static |
Known singleton pointers.
|
static |
Heap pointers to trace.