简体   繁体   English

V8 :: IdleNotification()永远不会返回true

[英]V8::IdleNotification() never returns true

For some reasons, sometimes the call of the IdleNotification never returns true. 由于某些原因,有时对IdleNotification的调用永远不会返回true。 The documentation states that 该文件指出

Optional notification that the embedder is idle. 嵌入程序处于空闲状态的可选通知。 V8 uses the notification to reduce memory footprint. V8使用该通知来减少内存占用。 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. 如果嵌入器在完成实际工作之前应停止调用IdleNotification,则返回true。 This indicates that V8 has done as much cleanup as it will be able to do. 这表明V8已经完成了尽可能多的清理工作。

So when the IdelNotifcation never returns true, it means that the garbage collector of V8 never finishes its work. 因此,当IdelNotifcation从不返回true时,这意味着V8的垃圾收集器永远不会完成其工作。

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 the Isolate instead of or before calling IdleNotification . 尝试在Isolate上调用LowMemoryNotification()而不是调用IdleNotification或在调用IdleNotification之前。 The former function informs V8 that it should work to free up memory. 前一个功能通知V8,它应该可以释放内存。 Without that memory pressure, it doesn't care about a few bytes that you may have allocated. 没有这种内存压力,它不会在乎您可能分配的几个字节。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM