v8 |手动启动垃圾收集器 [英] v8 | manually initiate the garbage collector
问题描述
有没有办法在Google的V8引擎上手动启动垃圾回收器?我找不到任何参考。通常情况下,GC支持这个功能。
您可以公开 v8 :: HEAP-> CollectAllGarbage
函数通过命令标记 - expose_gc
添加到
全局JavaScript名称空间。然后
简单地调用 gc();
。
通过声明:
while(!V8 :: IdleNotification()){};
参考文献:
>
Is there a way to manually initiate the garbage collector on Google's V8 engine? I couldn't find any reference for it. by usually GCs support this function.
You can expose the
v8::HEAP->CollectAllGarbage
function to the global JavaScript namespace via the command flag--expose_gc
. Then simply callgc();
.You can force garbage collection from C++ via the statement:
while(!V8::IdleNotification()) {};
References:
- http://code.google.com/p/v8/source/browse/trunk/src/extensions/gc-extension.cc
- http://code.google.com/p/v8/issues/detail?id=1688
这篇关于v8 |手动启动垃圾收集器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!