gc.h 880 Bytes
Newer Older
Damien's avatar
Damien committed
1
void gc_init(void *start, void *end);
2
3
4
5
6
7
8
9

// These lock/unlock functions can be nested.
// They can be used to prevent the GC from allocating/freeing.
void gc_lock(void);
void gc_unlock(void);

// A given port must implement gc_collect by using the other collect functions.
void gc_collect(void);
10
void gc_collect_start(void);
Damien's avatar
Damien committed
11
void gc_collect_root(void **ptrs, machine_uint_t len);
12
void gc_collect_end(void);
13

14
void *gc_alloc(machine_uint_t n_bytes, bool has_finaliser);
15
16
void gc_free(void *ptr);
machine_uint_t gc_nbytes(void *ptr);
Damien's avatar
Damien committed
17
void *gc_realloc(void *ptr, machine_uint_t n_bytes);
18
19
20
21
22
23
24
25
26
27
28

typedef struct _gc_info_t {
    machine_uint_t total;
    machine_uint_t used;
    machine_uint_t free;
    machine_uint_t num_1block;
    machine_uint_t num_2block;
    machine_uint_t max_block;
} gc_info_t;

void gc_info(gc_info_t *info);
29
void gc_dump_info(void);
30
void gc_dump_alloc_table(void);