darling-libobjc2/GCKit/malloc.h
theraven 5b1911b4f4 Initial commit of GCKit (moved from Étoilé and the missing 90% mostly implemented). GCKit implements cycle detection on the heap and tracing on the stack and designated heap regions, with support for weak references. It is designed for implementing OS X 10.5-compatible GC semantics.
Although GCKit is mostly finished, it is still not well tested.  It contains bugs, and possibly dragons.  Do not use it.  If you disregard this advice, do not file any bug reports.  If you disregard this instruction, then I will point and laugh at you.
2010-02-02 23:36:38 +00:00

32 lines
985 B
C

/**
* malloc.h - defines allocation and deallocation hooks and functions for GCKit.
*/
#include <string.h>
/**
* Allocate new memory.
*/
extern void *(*gc_alloc_with_zone)(void *zone, size_t bytes);
/**
* Free memory allocated by gc_alloc_with_zone().
*/
extern void (*gc_free_with_zone)(void *zone, void *mem);
/**
* Allocates an instance of a class, optionally with some extra bytes at the
* end.
*/
id GCAllocateObjectWithZone(Class cls, void *zone, size_t extraBytes);
/**
* Allocates a buffer of the specified size. The third parameter indicates
* whether this this memory should be scanned for untracked references. This
* buffer itself will be freed when the last reference to it is lost. If the
* scan parameter is set to YES then pointer assignments in this region should
* not use strong-cast assigns or GCRetain().
*/
void *GCAllocateBufferWithZone(void *zone, size_t size, BOOL scan);
void GCFreeObject(id object);
void GCFreeObjectUnsafe(id object);