20,741
edits
m (→Allocations) |
|||
| Line 133: | Line 133: | ||
struct Context* allContexts; | struct Context* allContexts; | ||
}; | }; | ||
</syntaxhighlight> | |||
Each memory pool must be initialized using naGCInit(): https://gitorious.org/fg/simgear/blobs/next/simgear/nasal/gc.c#line175 | |||
<syntaxhighlight lang="C"> | |||
void naGC_init(struct naPool* p, int type) | |||
{ | |||
p->type = type; | |||
p->elemsz = naTypeSize(type); | |||
p->blocks = 0; | |||
p->free0 = p->free = 0; | |||
p->nfree = p->freesz = p->freetop = 0; | |||
reap(p); | |||
} | |||
</syntaxhighlight> | </syntaxhighlight> | ||