darling-libobjc2/gc_none.c
theraven ad16172625 First pass at implementing Apple-compatible GC using Boehm. Still needs some tidying, but the following work:
- __strong pointers, preventing objects from being freed

_ __weak pointers are automatically freed when the last remaining __strong pointer goes away

- objc_gc_{retain,release}_np() functions, which can be used to implement CFRetain() and CFRelease() (adds an reference count - the object will not be collected until after its last retain is gone.
2011-05-22 23:02:04 +00:00

20 lines
373 B
C

#include "visibility.h"
#include "objc/runtime.h"
#include "gc_ops.h"
#include "class.h"
#include <stdlib.h>
static id allocate_class(Class cls, size_t extraBytes)
{
return calloc(cls->instance_size + extraBytes, 1);
}
PRIVATE struct gc_ops gc_ops_none =
{
.allocate_class = allocate_class
};
PRIVATE struct gc_ops *gc = &gc_ops_none;
PRIVATE BOOL isGCEnabled = NO;