Subj : Re: Garbage collector To : netscape.public.mozilla.jseng From : Andriy Rysin Date : Tue May 06 2003 11:52 am is there any way to trigger JS_GC from JavaScript itself? There's a problem of infinite memory consumption when watching dynamic images with JS http://bugzilla.mozilla.org/show_bug.cgi?id=203698 it seems to be still not fixed in cvs so if anyone could tell me how to (temporary) fix this in JS code I would really appreciate that. Thanks, Andriy Brendan Eich wrote: > Patricia Mainguet wrote: > >> Hello, >> >> Is there any way to know if the garbage collector runs(when the run >> time is a bit too small, for example)? >> >> > > See the JS_SetGCCallback and JS_SetGCCallbackRT APIs. > > You should consider running the GC yourself, by calling JS_GC when you > know your application has likely created a bunch of garbage (e.g., when > a browser window is closed in Mozilla), and calling JS_MaybeGC every so > often (say, once every 4096 backward branches, see > http://lxr.mozilla.org/mozilla/search?string=MAYBE_GC_BRANCH_COUNT_MASK). > > /be > >> Thanks >> >> Patricia >> >> > .