How the Nasal GC works: Difference between revisions

Jump to navigation Jump to search
m
Line 5: Line 5:


= Pool storage =
= Pool storage =
A memory pool is basically a preallocated region of memory
A memory pool is basically a preallocated region of memory
== Nasal memory pools ==


== Memory blocks ==
== Memory blocks ==
Line 52: Line 49:




All core memory allocation takes place via wrappers in [https://gitorious.org/fg/simgear/blobs/next/simgear/nasal/misc.c#line8 misc.c]:
== Nasal memory pools ==
 
<syntaxhighlight lang="C">
void naFree(void* m) { free(m); }
void* naAlloc(int n) { return malloc(n); }
void* naRealloc(void* b, int n) { return realloc(b, n); }
void naBZero(void* m, int n) { memset(m, 0, n); }
</syntaxhighlight>
 


The layout of the Nasal memory structure pool can be found in data.h, line 172: https://gitorious.org/fg/simgear/blobs/next/simgear/nasal/data.h#line172
The layout of the Nasal memory structure pool can be found in data.h, line 172: https://gitorious.org/fg/simgear/blobs/next/simgear/nasal/data.h#line172

Navigation menu