Subj : GC Question To : netscape.public.mozilla.jseng From : sukhisoul Date : Sun May 23 2004 11:50 pm Hello, In my Spidermonkey embedding, the prototype of getter function for the properties of one of my objects looks as follows: doc_getProperty(JSContext * cx, JSObject * obj, jsval id, jsval * vp) ; So far I was assuming that the last parameter, vp, is a rooted pointer.... But it appears that the assumption is not valid. The reason is that I had written code assuming that vp is rooted, but my application still crashed. I had created an array object and rooted it as follows: array = JS_NewArrayObject(cx, 0, NULL); *vp = OBJECT_TO_JSVAL(array); But after some time application crashed because the map pointer of array had become NULL. After changing my code to: array = JS_NewArrayObject(cx, 0, NULL); JS_AddRoot(cx, &array); *vp = OBJECT_TO_JSVAL(array); the bug disappeared. So can any body clarify the situation? Is vp already rooted or not? And if it is not rooted, will it be rooted as soon as my function returns, (because I am storing a new object I create in *vp and the object needs to be rooted.)? Thanks MA .