Subj : Is this gc-safe To : netscape.public.mozilla.jseng From : Thomas Sondergaard Date : Wed Aug 31 2005 10:35 am On my javascript object I want a property called 'geometry' that returns an array with the upper left and lower right corners of a box, ie. the value of the property might be: [ [0,0], [1,1] ]. This is the body of the getter function for the property. I wonder if this is okay, or do I need to root the objects as I create them to avoid garbage collection? vector ul = getUpperLeftCorner(); vector lr = getLowerRightCorner(); jsval ulj[2] = { DOUBLE_TO_JSVAL(JS_NewDouble(ctx, ul[0])), DOUBLE_TO_JSVAL(JS_NewDouble(ctx, ul[1])), }; jsval lrj[2] = { DOUBLE_TO_JSVAL(JS_NewDouble(ctx, lr[0])), DOUBLE_TO_JSVAL(JS_NewDouble(ctx, lr[1])), }; jsval ret[2] = { OBJECT_TO_JSVAL(JS_NewArrayObject(ctx, 2, ulj)), OBJECT_TO_JSVAL(JS_NewArrayObject(ctx, 2, lrj)) }; *vp = OBJECT_TO_JSVAL(JS_NewArrayObject(ctx, 2, ret)); return JS_TRUE; What jsapi function calls can invoke the gc? Thanks in advance, Thomas .