mirror of
https://github.com/darlinghq/darling-libobjc2.git
synced 2024-11-27 22:20:35 +00:00
ad16172625
- __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.
20 lines
373 B
C
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;
|
|
|