Subj : Re: Problem with the Garbage Collector To : Zaph From : Brendan Eich Date : Fri Mar 05 2004 11:12 am Zaph wrote: >Hi, > >I have several (identical) Scripts running simultaneously in several >contexts in the same runtime and they are being arbitrarily started >and stopped. It is possible that there is always at least one script >running. Therefore the garbage collector is never being started and >the engine locks up sooner or later due to not enough memory. > >Unfortunately I cannot change the way the scripts are being started >and it is possible that one script may run for days. > Days? Doing what? Computing Pi to the last digit? ;-) Surely your scripts are calling native methods, some of which do i/o, possibly even blocking i/o. The rule you are failing to follow is that every such native must suspend requests on its cx parameter, resuming them after it returns from the blocking call. > I am using >JS_BeginRequest and JS_EndRequest to prevent the GC to start while >there are scripts active. > > Good, but you're not following all the of the request model's rules. >Is there a way to start the Garbage Collector while the scripts are >active > Not "active" in the sense of "in a request", no. That's by design, that's why you need to suspend or end requests often. /be .