How the Nasal GC works: Difference between revisions

Jump to navigation Jump to search
m
Line 209: Line 209:
</syntaxhighlight>
</syntaxhighlight>


The garbage collector itself is triggered by setting the global "needGC" flag to 1 in the globals structure and then calling the bottleneck() function: https://gitorious.org/fg/simgear/blobs/next/simgear/nasal/gc.c#line199
As can be seen, the garbage collector itself is triggered by setting the global "needGC" flag to 1 in the globals structure and then calling the bottleneck() function: [https://gitorious.org/fg/simgear/blobs/next/simgear/nasal/gc.c#line199].
In line 209, the memory region from the global pool is cast to a pointer (struct naObj**): https://gitorious.org/fg/simgear/blobs/next/simgear/nasal/gc.c#line209
 
In line 209, the memory region from the global pool is cast back to a pointer (struct naObj**): https://gitorious.org/fg/simgear/blobs/next/simgear/nasal/gc.c#line209
the "nout" paramter is just there to update c->nfree[type] with the amount of free memory.
the "nout" paramter is just there to update c->nfree[type] with the amount of free memory.


Navigation menu