Eclipse:垃圾收集器按钮

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2774896/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 19:22:27  来源:igfitidea点击:

Eclipse: Garbage Collector Button

eclipsegarbage-collection

提问by dogbane

What happens when I press the "Run Garbage Collector" button in Eclipse? Does it just call System.gc()?

当我在 Eclipse 中按下“运行垃圾收集器”按钮时会发生什么?它只是调用 System.gc() 吗?

回答by VonC

Yes, it is strictly a call to the JVM, not to an internal Eclipse function (see this thread).

是的,它严格来说是对 JVM 的调用,而不是对内部 Eclipse 函数的调用(请参阅此线程)。

Don't forget the Memory Analyzerto also check paths to garbage collection roots (in a Head Dump) if you suspect some memory leaking in your Eclipse session.

如果您怀疑 Eclipse 会话中存在某些内存泄漏,请不要忘记内存分析器还要检查垃圾收集根的路径(在 Head Dump 中)。

Note: that button is only available if you select the "Show Heap status" in the General section of the Eclipse preferences:

注意:只有在 Eclipse 首选项的 General 部分中选择“Show Heap status”时,该按钮才可用:

alt text

替代文字

回答by Jorgesys

Yes, the System.gc()is called!

没错,System.gc()就是叫!

Very useful in the Eclipse –>Preferences–>General-> Show heap status

Eclipse中非常有用-->Preferences-->General-> Show heap status

enter image description here

在此处输入图片说明

then you can see in the lower right corner the "trash can" to run the Garbage Collector. =)

然后你可以在右下角看到“垃圾桶”来运行垃圾收集器。=)

回答by Thomas Pornin

Yes, System.gc()is called when the "Run Garbage Collector" button is pressed.

是,System.gc()在按下“运行垃圾收集器”按钮时调用。