When does garbage collection work in java?(垃圾收集何时在 Java 中工作?)
问题描述
我知道有很多关于java垃圾收集的文章,但是搜索后我不知道什么时候在java应用程序中运行垃圾收集?(当应用程序重新启动或仍在运行时)".
I knew that there are a lot of articles about java garbage collection but after searching I don't know exactly "when dose the garbage collection run in a java application?(when the application restart or while it still running)".
推荐答案
Garbage Collector
是一个守护线程.一个守护线程在应用程序后面运行.它由JVM启动.这当所有非 dameon 线程停止时,线程停止.
Garbage Collector
is a dameon thread. A dameon thread runs behind the application. It is started by JVM. The
thread stops when all non-dameon threads stop.
JVM 控制垃圾收集器;它决定何时运行垃圾收集器.JVM 运行当垃圾收集器意识到内存不足时.GC的行为可以通过将参数传递给 JVM
进行调整.
The JVM controls the Garbage Collector; it decides when to run the Garbage Collector. JVM runs
the Garbage Collector when it realizes that the memory is running low. The behavior of GC can
be tuned by passing parameters to JVM
.
可以请求垃圾收集从在 java 程序中,但不能保证此请求将由jvm.Check 如何在Java中强制垃圾回收?
One can request the Garbage Collection to happen from within the java program but there is no guarantee that this request will be taken care of by jvm.Check How to force garbage collection in Java?
了解更多..
这篇关于垃圾收集何时在 Java 中工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:垃圾收集何时在 Java 中工作?
基础教程推荐
- Java:带有char数组的println给出乱码 2022-01-01
- Java Keytool 导入证书后出错,"keytool error: java.io.FileNotFoundException &拒绝访问" 2022-01-01
- 如何使用 Java 创建 X509 证书? 2022-01-01
- “未找到匹配项"使用 matcher 的 group 方法时 2022-01-01
- 降序排序:Java Map 2022-01-01
- FirebaseListAdapter 不推送聊天应用程序的单个项目 - Firebase-Ui 3.1 2022-01-01
- 在 Libgdx 中处理屏幕的正确方法 2022-01-01
- 减少 JVM 暂停时间 >1 秒使用 UseConcMarkSweepGC 2022-01-01
- 设置 bean 时出现 Nullpointerexception 2022-01-01
- 无法使用修饰符“public final"访问 java.util.Ha 2022-01-01