On Sun, 10 Apr 2011, Curtis Olson wrote: > I'm not an expert in nasal garbage collection, but I think the problem is > that garbage collection is not something we can divide up into chunks (which > is essentially what threading would do.) In addition, threading adds a lot > of potential order dependent bugs. I've got a whole soapbox speech on > threading I could deliver which I would summarize as "only if absolutely no > other solution is viable." > > In the case of nasal, I believe the garbage collection pass must be done in > a single atomic step, otherwise it would leave the heap in > an inconsistent state and adversely affect the scripts.
There are algorithms for incremental and/or concurrent and/or parallel garbage collection out there. They most likely not easy to implement and as far as I have seen so far would require (at least for concurrent and /or parallel GC) all writes of pointers to the Nasal heap (and possibly reads) to be redirected via wrapper functions (also known as (GC) read/write barriers). This will not be an easy task but in my opinion it would be a promising option. It might be possible to use a GC module from a GPL:d Java vm or similar. Btw, just running the normal (mutually exclusive) Nasal GC in another thread than the main loop is not hard - but since it is mutually exclusive to executing Nasal functions it doesn't help much when it comes to reducing the worst case latency. The small changes needed to add a separate GC thread are available here: http://www.gidenstam.org/FlightGear/misc/test/sg-gc-2.diff http://www.gidenstam.org/FlightGear/misc/test/fg-gc-1.diff Cheers, Anders -- --------------------------------------------------------------------------- Anders Gidenstam WWW: http://www.gidenstam.org/FlightGear/ ------------------------------------------------------------------------------ Xperia(TM) PLAY It's a major breakthrough. An authentic gaming smartphone on the nation's most reliable network. And it wants your games. http://p.sf.net/sfu/verizon-sfdev _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel