Subj : Re: JS_GC, JS_DestroyContext crash To : netscape.public.mozilla.jseng From : prohto@yahoo.com (Carlos F.) Date : Mon Jan 26 2004 12:29 pm Hi again, here is the backtrace after receiving a SIGSEGV when I run JS_GC: 0xfec86c40 in JS_HashTableRawRemove (ht=0xdb4a8, hep=0x1392a0, he=0x10) at jshash.c:309 309 next = he->next; Current language: auto; currently c (gdb) bt #0 0xfec86c40 in JS_HashTableRawRemove (ht=0xdb4a8, hep=0x1392a0, he=0x10) at jshash.c:309 #1 0xfecf5688 in js_PurgeDeflatedStringCache (str=0xbf008) at jsstr.c:2598 #2 0xfecf57d4 in js_FinalizeStringRT (rt=0xb99b0, str=0xbf008) at jsstr.c:2627 #3 0xfecf56b4 in js_FinalizeString (cx=0xbc8e0, str=0xbf008) at jsstr.c:2606 #4 0xfec85e14 in js_GC (cx=0xbc8e0, gcflags=0) at jsgc.c:1324 #5 0xfec85180 in js_ForceGC (cx=0xbc8e0, gcflags=0) at jsgc.c:1000 #6 0xfec416b8 in JS_GC (cx=0xbc8e0) at jsapi.c:1675 #7 0x2040c in _ZN11ApplChannel5ClearEv (this=) at ApplChannel.C:136 #8 0x1b2b4 in _Z14APPL_TIMER_msgPcP11ApplChannel (buffer=0xffbee2d0 "", chan=0xb8898) at appl_timer.C:58 #9 0x1a8e4 in _Z13APPL_CTRL_entv () at appl_ctrl.C:118 #10 0x1b0c8 in main (argc=2, argv=0xffbef3bc) at appl_main.C:143 Brendan Eich wrote in message news:<401498F4.8000701@meer.net>... > Carlos F. wrote: > > Tnaks for the link. I solved the problem of GC following the example, > > but I dind't realy undestand how the GC works. > > Now I have onother cuestion, if I define properties with > > JS_DefineProperty, or if I create object with JS_DefineObject, is > > there some procedure to destroy it and release eny resource used by > > it, or it is enought to run JS_GC. Or JS_GC only release resouces take > > by executed scprits? > > Garbage collection means you don't call "free" or "destroy" methods for > the garbage-collected things, you let the GC recycle them when they > become unreachable. Hence roots, global and local, which you must > manage so that things stay alive as long as necessary, and no longer. > And you should call JS_GC or JS_MaybeGC appropriately. > > /be .