How the Nasal GC works: Difference between revisions

Jump to navigation Jump to search
m
→‎Contexts: https://sourceforge.net/p/flightgear/mailman/message/36765215/
(→‎Contexts: https://forum.flightgear.org/viewtopic.php?f=38&t=33831&p=328188#p328188)
m (→‎Contexts: https://sourceforge.net/p/flightgear/mailman/message/36765215/)
Line 1,048: Line 1,048:


</nowiki><ref>{{cite web |url=http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg13028.html|title=<nowiki>[Flightgear-devel] Stutter/Nasal issue resolved (was: FlightGear/Plib periodic stutter notes)</nowiki>|author=<nowiki>Andy Ross</nowiki>|date=<nowiki>Wed, 24 Oct 2007 11:33:36 -0700</nowiki>}}</ref>|<nowiki>Andy Ross</nowiki>}}
</nowiki><ref>{{cite web |url=http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg13028.html|title=<nowiki>[Flightgear-devel] Stutter/Nasal issue resolved (was: FlightGear/Plib periodic stutter notes)</nowiki>|author=<nowiki>Andy Ross</nowiki>|date=<nowiki>Wed, 24 Oct 2007 11:33:36 -0700</nowiki>}}</ref>|<nowiki>Andy Ross</nowiki>}}
{{cquote|<nowiki>
The problem is the fact that Nasal recycles context objects - it keeps a pool of freed contexts around. At the point we shutdown Nasal, all contexts should be inactive, i.e in the free list (and they are, phew). Free-ed contexts are still considered for GC however, and there seems to be an issue that the opStack (part of the stack machine which implements the core bytecode interpreter of Nasal) doesn’t end up empty in some situations.
So my work around is to clear the opStack (and frameStack) to zero, inside naFreeContext. This then matches the state for a new (non-recycled) context, and ensures that on the next GC cycle, items referenced by the opStack aren’t marked as in-use. (At least to me it makes sense, that a freed context - which is therefore inaccessible - shouldn’t be retaining items in its opStack into its next re-use)
The ideal fix would be to find out *why* the opStack doesn’t return to empty ‘naturally’ before the context is freed
</nowiki><ref>{{cite web |url=https://sourceforge.net/p/flightgear/mailman/message/36765215/|title=<nowiki>[Flightgear-devel] Resetting Nasal (was Re: Implementing aircraft.nas in C++)</nowiki>|author=<nowiki>James Turner</nowiki>|date=<nowiki>2019-09-17 17:43:53</nowiki>}}</ref>|<nowiki>James Turner</nowiki>}}


<references/>
<references/>

Navigation menu