Subj : Re: Puzzling assertion in js_AllocGCThing() To : Bob Kline From : Brendan Eich Date : Fri Mar 12 2004 05:06 pm Bob Kline wrote: > I'm working on tracking down failures in Sablotron (open source XSL/T > engine) when JavaScript is used, and I've run into an assertion in jsgc.c > (line 461) from SpiderMonkey version 1.5 RC6: > > JS_ASSERT(!rt->gcRunning); > > Could someone explain why the assumption that no other thread would be > running garbage collection when js_AllocGCThing() is invoked is valid? If > there is a good explanation for this assumption, I'll take it back to the > maintenance team for Sablotron, and there's a good chance that we'll have a > good clue for the underlying cause of the failures we're seeing. Sure -- the GC is single-threaded and must interlock with allocators. Also, an allocator can't nest from a finalizer called from the GC. If you have an allocator racing with the GC, you're not using the request model (JS_BeginRequest etc.) properly. But more likely, a finalizer is allocating new objects. That's not allowed, although several years ago it was. /be .