For some reasons, sometimes the call of the IdleNotification never returns true. The documentation states that
Optional notification that the embedder is idle. V8 uses the notification to reduce memory footprint. This call can be used repeatedly if the embedder remains idle. Returns true if the embedder should stop calling IdleNotification until real work has been done. This indicates that V8 has done as much cleanup as it will be able to do.
So when the IdelNotifcation never returns true, it means that the garbage collector of V8 never finishes its work.
Because I cannot really find the reason for this behavior I would be glad if anybody could give me a hint what might cause this.
Try calling
LowMemoryNotification()
on theIsolate
instead of or before callingIdleNotification
. The former function informs V8 that it should work to free up memory. Without that memory pressure, it doesn't care about a few bytes that you may have allocated.