Gerhans:

It seems like you are leaking memory from the void* not getting cleaned up,
and that the void* is being passed to the SetAccessor function for some
generic getter/setter purpose?

If its the case that the callback is not firing, perhaps its true that the
V8 Garbage Collector is not firing the MakeWeak function because there is
no reference in your Javascript Context to said External handle? (i.e, you
are using the External handle as a data parameter to the SetAccessor
function, but since it isn't an internal field of an object that is within
the Javascript context, the GC doesn't know about it and thus never sees it
on its collection passes and never fires the Weak callback on it because
its not on its list?)

Anyone know if thats typical V8 GC behavior?

(Maybe the fix here is to put the MakeWeak callback on the FunctionTemplate
itself? That way, if the constructor function ever dissapears from the
context and there are no child objects left in the context, the MakeWeak
callback will fire and appropriately get rid of the void* data you pass.)


On Sat, Apr 14, 2012 at 8:52 AM, Gerhans <[email protected]> wrote:

> @Stephan - thanks for at least confirming I'm not doing anything obviously
> wrong.
>
> @Charles - I'm sorry the code looks messy to you. I wasn't anticipating
> the Google Groups web interface introducing a hard-wrap into my post. If
> you have suggestions for improvement beyond the resulting illegible
> formatting I'd appreciate them.
>
> That said, I'm not sure how the nature of the void *data affects the
> question. If it's relevant for some reason I don't understand, it represent
> a small class encoding a pointer to member variable. The problem is that my
> "dataDeleterFn" never fires (which I have double-confirmed through
> breakpoints). I have already confirmed this is the source of my leak using
> Instruments on Mac OS X, and I've forced V8 to garbage collect so it's not
> a matter of waiting out GC.
>
> Thanks again...
>
>
> On Saturday, April 14, 2012 1:35:06 AM UTC-4, Charles wrote:
>>
>> The code is very ugly/messy.
>>
>> Do you have a base class? What kind of object is your data?
>>
>> What kind of data structure or abstract data type is this?
>>
>> There's a function/method called MakeWeak, so there's some kind of
>> strength value involved?
>>
>> You have a leak? The problem might be bigger than that. Simplify. Make
>> your code clearer to understand.
>>
>  --
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users
>

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to