How the Nasal GC works: Difference between revisions

Jump to navigation Jump to search
m
Line 254: Line 254:
= naNew() =
= naNew() =


As can be seen, the key allocator function is [https://gitorious.org/fg/simgear/blobs/next/simgear/nasal/misc.c#line66 naNew()]. naNew() is really just a fancy malloc() replacement, i.e. it's just getting passed the Nasal execution context, and the nasal type (which is mapped to the size of the requested memory region using naTypeSize()).
As can be seen, the key allocator function is [https://gitorious.org/fg/simgear/blobs/next/simgear/nasal/misc.c#line66 naNew()].  
All memory allocations done via the naNew*() helpers will first of all set up memory using naNew().
 
naNew() is really just a fancy malloc() replacement, i.e. it's just getting passed the Nasal execution context, and the nasal type (which is mapped to the size of the requested memory region using naTypeSize()).


The naNew() function is also implemented in misc.c, see [https://gitorious.org/fg/simgear/blobs/next/simgear/nasal/misc.c#line122 line 66]:
The naNew() function is also implemented in misc.c, see [https://gitorious.org/fg/simgear/blobs/next/simgear/nasal/misc.c#line122 line 66]:
Line 303: Line 306:
}
}
</syntaxhighlight>
</syntaxhighlight>


= The GC interface =
= The GC interface =

Navigation menu