Detailed Description
The following functions allocate garbage-collected memory with an associated type descriptor.
Define Documentation
#define CUOO_OBJ_ALLOC_SIZEG |
( |
struct_size |
|
) |
|
Value:(((struct_size) + sizeof(cuex_meta_t) \
+ CU_GRAN_SIZE - 1 + CUP_OBJ_EXTRA_BYTES)/CU_GRAN_SIZE)
#define cuoo_onew |
( |
prefix |
|
) |
|
Value:((struct prefix *) \
cuoo_oalloc(prefix##_type(), sizeof(struct prefix)))
#define cuoo_onew_ord_fin |
( |
prefix |
|
) |
|
Value:((struct prefix *) \
cuexP_oalloc_ord_fin_raw(cuoo_type_to_meta(prefix##_type()), \
CUOO_OBJ_ALLOC_SIZEG(sizeof(struct prefix))))
Function Documentation
Allocate a dynamically typed object. The result points to a memory region of at least size bytes, where the actual object data is stored. The type information is stored before this pointer.
void* cuoo_oalloc_ord_fin |
( |
cuoo_type_t |
type, |
|
|
size_t |
size | |
|
) |
| | |
As cuoo_oalloc, except that the finaliser in type is run before the object is reclaimed by the garbage collector. Objects reachable from the finaliser are kept at least until the next GC cycle.
void* cuoo_oalloc_self_instance |
( |
size_t |
size |
) |
|
A variant of cuoo_oalloc which sets the type of the returned object to the object itself. The returned memory must be initialised as a type, which then becomes it's own type.
void* cuoo_oalloc_unord_fin |
( |
cuoo_type_t |
type, |
|
|
size_t |
size | |
|
) |
| | |
As cuoo_oalloc, except that the finaliser in type is run before the object is reclaimed by the garbage collector. Objects reachable from the finaliser may already have been reclaimed when the finaliser is run, and shall therefore not be dereferenced. If this is not desirable, see cuoo_oalloc_ord_fin.