Re: [v8-users] Return a Weak Persistent to JS

2021-01-19 Thread Vinayaka Kamath
Hello d3c...@gmail.com, I am trying to do the exact same thing. But I am forcing GC with LowMemoryNotification since I want to force release of resources. v8 is intermittently crashing and I've narrowed it down to the call of LowMemoryNotification. Also I am using embedded v8 instead of node. O

Re: [v8-users] Return a Weak Persistent to JS

2021-01-19 Thread J Decker
On Tue, Jan 19, 2021 at 4:44 AM Vinayaka Kamath < vinayaka.kam...@couchbase.com> wrote: > Is there any better way to do it? Basically I am exposing an Object > Template to JS through weak persistent handle and it holds internal > resources with it. When the object is no longer accessible in the cu

Re: [v8-users] Return a Weak Persistent to JS

2021-01-19 Thread Ben Noordhuis
On Tue, Jan 19, 2021 at 1:44 PM Vinayaka Kamath wrote: > > Is there any better way to do it? Basically I am exposing an Object Template > to JS through weak persistent handle and it holds internal resources with it. > When the object is no longer accessible in the current executing scope of the

Re: [v8-users] Return a Weak Persistent to JS

2021-01-19 Thread Vinayaka Kamath
Is there any better way to do it? Basically I am exposing an Object Template to JS through weak persistent handle and it holds internal resources with it. When the object is no longer accessible in the current executing scope of the JS code, I want to free up all the resources held by the insta

Re: [v8-users] Return a Weak Persistent to JS

2021-01-19 Thread Ben Noordhuis
On Tue, Jan 19, 2021 at 12:26 PM Vinayaka Kamath wrote: > > It seems like the v8 is crashing when I follow this. To add more to what I am > trying to do, when the "value" goes out of scope I want it to get garbage > collected and in the callback, I am freeing up resources held by the value. I >

Re: [v8-users] Return a Weak Persistent to JS

2021-01-19 Thread Vinayaka Kamath
It seems like the v8 is crashing when I follow this. To add more to what I am trying to do, when the "value" goes out of scope I want it to get garbage collected and in the callback, I am freeing up resources held by the value. I am basically forcing GC using isolate->LowMemoryNotification() on

Re: [v8-users] Return a Weak Persistent to JS

2021-01-18 Thread J Decker
On Mon, Jan 18, 2021 at 5:28 AM Vinayaka Kamath < vinayaka.kam...@couchbase.com> wrote: > Hello All, > > I am trying to return a weak persistent handle to JS through a function > template. However the v8 is crashing on triggering the codepath. What is > the correct way to do it? > My intention is

[v8-users] Return a Weak Persistent to JS

2021-01-18 Thread Vinayaka Kamath
Hello All, I am trying to return a weak persistent handle to JS through a function template. However the v8 is crashing on triggering the codepath. What is the correct way to do it? My intention is to trigger GC on the persistent handle when it goes out of scope. __