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 example, NowWouldBeAGoodTimeForATinyBitOfIncrementalGCWork. The latter concept is handled by idle notifications, which embedders can use to tell V8 "I'm gonna be sitting around idling for the next X milliseconds anyway, you might as well use the time to do some work". There's no guarantee that V8 will in fact do any work in this case; however in many cases it will do some incremental marking. On Sun, Jan 24, 2016 at 11:07 AM, Ben Noordhuis <i...@bnoordhuis.nl> wrote: > On Sat, Jan 23, 2016 at 10:27 PM, Jane Chen <jxche...@gmail.com> 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 small batches? > > It does a full GC (several, actually) so yes, it's pretty expensive. > > -- > -- > 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 > "v8-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to v8-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- -- 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 "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.