Loading...
Searching...
No Matches
mjs_mm.h
1/*
2 * Copyright (c) 2014-2016 Cesanta Software Limited
3 * All rights reserved
4 */
5
6#ifndef MJS_MM_H_
7#define MJS_MM_H_
8
9#include "mjs_internal.h"
10
11#if defined(__cplusplus)
12extern "C" {
13#endif /* __cplusplus */
14
15struct mjs;
16
17typedef void (*gc_cell_destructor_t)(struct mjs* mjs, void*);
18
19struct gc_block {
20 struct gc_block* next;
21 struct gc_cell* base;
22 size_t size;
23};
24
25struct gc_arena {
26 struct gc_block* blocks;
27 size_t size_increment;
28 struct gc_cell* free; /* head of free list */
29 size_t cell_size;
30
31#if MJS_MEMORY_STATS
32 unsigned long allocations; /* cumulative counter of allocations */
33 unsigned long garbage; /* cumulative counter of garbage */
34 unsigned long alive; /* number of living cells */
35#endif
36
37 gc_cell_destructor_t destructor;
38};
39
40#if defined(__cplusplus)
41}
42#endif /* __cplusplus */
43
44#endif /* MJS_MM_H_ */
Definition mjs_mm.h:25
Definition mjs_mm.h:19
Definition mjs_gc.h:25
Definition mjs_core.h:63