Re: [v8-users] Re: Weak callback for function callback data never getting called

2016-10-05 Thread Zac Hansen
Also, here's the somewhat generalized code I use for doing this in my integration library: https://github.com/xaxxon/v8toolkit/blob/master/include/v8toolkit.h#L972 On Wed, Oct 5, 2016 at 8:36 PM, Zac Hansen wrote: > Good news is, this program calls the callback. Bad news it

Re: [v8-users] Re: Weak callback for function callback data never getting called

2016-10-05 Thread Zac Hansen
Good news is, this program calls the callback. Bad news it crashes, but I think it demonstrates the general idea. I believe the problem with your program is that your global with the weak callback goes away too early. In my program below you can see I'm allocating the global on the heap (and

Re: [v8-users] Re: Weak callback for function callback data never getting called

2016-10-05 Thread tblodt
Actually, that didn't work. Any other ideas? Any techniques for debugging GC (like getting information on where an object is referenced?) -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to

Re: [v8-users] Re: Weak callback for function callback data never getting called

2016-10-05 Thread Zac Hansen
It's in the v8::mother experimental namespace :-) On Wednesday, October 5, 2016, wrote: > Why didn't I think of that? > > Put a(mother) handle scope inside the for loop >> > > Also, autocorrect failure ^ > > -- > -- > v8-users mailing list > v8-users@googlegroups.com >

Re: [v8-users] Re: Weak callback for function callback data never getting called

2016-10-05 Thread tblodt
Why didn't I think of that? Put a(mother) handle scope inside the for loop > Also, autocorrect failure ^ -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups

Re: [v8-users] Re: Weak callback for function callback data never getting called

2016-10-05 Thread Zac Hansen
The loop is inside the handle scope if I'm reading to correctly so the handle scope keeps a reference to everything meaning it can't be gc On Wednesday, October 5, 2016, wrote: > Thanks for all your feedback. I tried attaching the weak callback to the > function instead of

Re: [v8-users] Re: Weak callback for function callback data never getting called

2016-10-05 Thread tblodt
Thanks for all your feedback. I tried attaching the weak callback to the function instead of the callback data, and I tried a tight loop with AdjustAmountOfExternalAllocatedMemory. But the weak callback still isn't getting called. Here's the updated main function: int main() {

Re: [v8-users] Re: Weak callback for function callback data never getting called

2016-10-04 Thread Jochen Eisinger
the function template won't ever get gc'd after you've instantiated it once. On Wed, Oct 5, 2016 at 12:56 AM Zac Hansen wrote: > Put your inner block in a tight loop and throw in a >

Re: [v8-users] Re: Weak callback for function callback data never getting called

2016-10-04 Thread Zac Hansen
Put your inner block in a tight loop and throw in a http://v8.paulfryzel.com/docs/master/classv8_1_1_isolate.html#aaeda5fa60961a3d9d476c46200e30711 isolate->AdjustAmountOfExternalAllocatedMemory(100) in there too and see what happens. On Tue, Oct 4, 2016 at 3:48 PM, Theodore Dubois

Re: [v8-users] Re: Weak callback for function callback data never getting called

2016-10-04 Thread Theodore Dubois
I created the FunctionTemplate inside its own HandleScope which gets destroyed before the program finishes, so it should get garbage collected before the end of the program. Is that right? ~Theodore > On Oct 4, 2016, at 3:45 PM, Zac Hansen wrote: > > The way I read it is

Re: [v8-users] Re: Weak callback for function callback data never getting called

2016-10-04 Thread Zac Hansen
The way I read it is that because the function template remains until the end of the program, its data cannot be cleaned up. And since it has to keep str around until the function template goes away, str won't be cleaned up either because there's still a reference to it. On Tue, Oct 4, 2016 at

Re: [v8-users] Re: Weak callback for function callback data never getting called

2016-10-04 Thread Theodore Dubois
Interesting. So when a function template is created, its callback data will never be freed? ~Theodore > On Oct 4, 2016, at 1:17 AM, Jochen Eisinger wrote: > > v8 has an per-isolate cache of function templates. As the string is > referenced by the function template, it

[v8-users] Re: Weak callback for function callback data never getting called

2016-10-02 Thread Zac Hansen
http://v8.paulfryzel.com/docs/master/classv8_1_1_persistent_base.html#aebb8a2c97e219102f613ff3749c956f6 Specifically: NOTE: There is no guarantee as to *when* or even *if* the callback is > invoked. The invocation is performed solely on a best effort basis. As > always, GC-based finalization