Vuo  0.3
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Macros | Functions | Variables
VuoHeap.cc File Reference

Description

VuoHeap implementation.

Macros

#define printDebugMsg(format,...)
 

Functions

void finalizeReferenceCounts (void)
 Cleans up the reference-counting system.
 
void printReferenceCounts ()
 Prints all reference-counted pointers, for debugging.
 
void * vuoAlloc (size_t numBytes)
 Allocates memory on the heap, and registers its pointer to be reference-counted.
 
int vuoRegister (void *heapPointer)
 Registers heapPointer to be reference-counted.
 
int vuoRetain (void *heapPointer)
 Increments the reference count for heapPointer.
 
int vuoRelease (void *heapPointer)
 Decrements the reference count for heapPointer.
 

Variables

map< void *, int > referenceCounts
 
dispatch_semaphore_t referenceCountsSemaphore = NULL
 
bool referenceCountsDebugMode = false
 

Macro Definition Documentation

#define printDebugMsg (   format,
  ... 
)
Value:
do { \
fprintf(stdout, "VuoHeapCoreDEBUG: " format, ## __VA_ARGS__); \
fflush(stdout); \
} while (0)

Function Documentation

void finalizeReferenceCounts ( void  )

Cleans up the reference-counting system.

To be called once, after all other reference-counting function calls.

void* vuoAlloc ( size_t  numBytes)

Allocates memory on the heap, and registers its pointer to be reference-counted.

Parameters
numBytesThe number of bytes to allocate.
Returns
The pointer to the allocated memory.
int vuoRegister ( void *  heapPointer)

Registers heapPointer to be reference-counted.

If heapPointer is already being reference-counted, does nothing.

Parameters
heapPointerA pointer to allocated memory on the heap.
Returns
The updated reference count of heapPointer. This is 0 unless heapPointer is already being reference-counted.
int vuoRelease ( void *  heapPointer)

Decrements the reference count for heapPointer.

Defined in the graph's generated code.

If the reference count becomes 0, heapPointer is freed and is no longer reference-counted.

Parameters
heapPointerA pointer to allocated memory on the heap.
Returns
The updated reference count of heapPointer.
int vuoRetain ( void *  heapPointer)

Increments the reference count for heapPointer.

Parameters
heapPointerA pointer to allocated memory on the heap.
Returns
The updated reference count of heapPointer.