Re: [v8-users] LowMemoryNotification in for...of loop.

2016-01-25 Thread Jakob Kummerow
Right. The canonical answer to "When and how often should I manually trigger GC?" is "You shouldn't."; this is true for pretty much all virtual machines. The GC itself knows best when and how often to do incremental work. There's a reason the function is called LowMemoryNotification and not, for

Re: [v8-users] LowMemoryNotification in for...of loop.

2016-01-24 Thread Ben Noordhuis
On Sat, Jan 23, 2016 at 10:27 PM, Jane Chen wrote: > Now that we are on this, can I ask more questions about GC: > > Is calling LowMemoryNotification() expensive? Should I only do it when I > absolutely need more memory to continue, or should I do it proactively and > in

Re: [v8-users] LowMemoryNotification in for...of loop.

2016-01-23 Thread Jane Chen
Now that we are on this, can I ask more questions about GC: Is calling LowMemoryNotification() expensive? Should I only do it when I absolutely need more memory to continue, or should I do it proactively and in small batches? On Friday, January 22, 2016 at 11:41:08 PM UTC-8, Jane Chen wrote:

Re: [v8-users] LowMemoryNotification in for...of loop.

2016-01-22 Thread Jochen Eisinger
would you mind filing a bug for this? Ideally, with a self-contained repro case! thanks -jochen On Fri, Jan 22, 2016 at 12:23 AM Jane Chen wrote: > Embedding v8 4.6.88. > > Suppose my native function sequence() returns a JavaScript iterable > wrapping a long sequence of

Re: [v8-users] LowMemoryNotification in for...of loop.

2016-01-22 Thread Jane Chen
Jochen, My bad. I only registered a callback for the iterable object returned from sequence(), but not for the iterator returned from [Symbol.iterator](). v8 did the right thing by freeing the iterable object in this case. So the bug was in my code. Thanks for your response. Jane On

[v8-users] LowMemoryNotification in for...of loop.

2016-01-21 Thread Jane Chen
Embedding v8 4.6.88. Suppose my native function sequence() returns a JavaScript iterable wrapping a long sequence of internal objects; function gc() invokes v8::Isolate::LowMemoryNotification(). To reduce memory consumption of the iterable, gc() needs to be called periodically to release the