Subj : Re: question: memory allocated by JS_Enumerate(). To : jp From : Brendan Eich Date : Fri May 06 2005 09:57 am jp wrote: > >>> 2. It seems, if I don't use JS_DestroyIdArray() to release the >>> pointer, the memory will not be released even after I destroy the >>> context and runtime. Is that true? >> >> >> >> >> Yes. >> >> > > just curious, why did you decide that this pointer not being managed by > runtime? The JS GC is not "conservative", it cannot magically tell when you are done using an arbitrary piece of memory. It handles only certain well-aligned allocations, and it marks them starting from a set of "roots", which you must supplement when your embedding holds pointers to GC-things in C or C++ data structures in the malloc heap and in static memory. The manually allocated data structures are used in a LIFO fashion, most of the time, so it is not a great hardship to require that they be freed or destroyed by hand. /be .