Custom JSMarkOp callback not triggered in GC

View: New views
2 Messages — Rating Filter:   Alert me  

Custom JSMarkOp callback not triggered in GC

by mohan.dhawan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi All,

I have added a custom object to SpiderMonkey and am testing it with
the browser integrated. Everything works fine except the Garbage
Collector. My custom object has several JSObject* as its private data
members. I have also declared the JSClass flags as
JSCLASS_MARK_IS_TRACE and defined the JSMarkOp callback as
JS_CLASS_TRACE(custom_trace). In this custom_trace, i walk over all
the private JSObject* and invoke JS_CallTracer after checking their
traceability.

The strange problem is that this custom_trace callback is never
triggered. My logs confirm that it is not invoked - I have a print
statement to dump the function invocation to a file.

Is there something that I have missed out? Any pointers will be
helpful.

Regards,
mohan
_______________________________________________
dev-tech-js-engine mailing list
dev-tech-js-engine@...
https://lists.mozilla.org/listinfo/dev-tech-js-engine

Re: Custom JSMarkOp callback not triggered in GC

by Jason Orendorff-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 10/19/2009 09:53 AM, Mohan wrote:

> I have added a custom object to SpiderMonkey and am testing it with
> the browser integrated. Everything works fine except the Garbage
> Collector. My custom object has several JSObject* as its private data
> members. I have also declared the JSClass flags as
> JSCLASS_MARK_IS_TRACE and defined the JSMarkOp callback as
> JS_CLASS_TRACE(custom_trace). In this custom_trace, i walk over all
> the private JSObject* and invoke JS_CallTracer after checking their
> traceability.
>
> The strange problem is that this custom_trace callback is never
> triggered. My logs confirm that it is not invoked - I have a print
> statement to dump the function invocation to a file.
>
> Is there something that I have missed out? Any pointers will be
> helpful.

If it's not being called, perhaps the object is not reachable: it's
garbage, soon to be collected. If that's the case, then the finalizer,
if any, will be called instead.

-j
_______________________________________________
dev-tech-js-engine mailing list
dev-tech-js-engine@...
https://lists.mozilla.org/listinfo/dev-tech-js-engine