<small id='1j0W5'></small><noframes id='1j0W5'>

    <tfoot id='1j0W5'></tfoot>
  • <legend id='1j0W5'><style id='1j0W5'><dir id='1j0W5'><q id='1j0W5'></q></dir></style></legend>
      • <bdo id='1j0W5'></bdo><ul id='1j0W5'></ul>

        <i id='1j0W5'><tr id='1j0W5'><dt id='1j0W5'><q id='1j0W5'><span id='1j0W5'><b id='1j0W5'><form id='1j0W5'><ins id='1j0W5'></ins><ul id='1j0W5'></ul><sub id='1j0W5'></sub></form><legend id='1j0W5'></legend><bdo id='1j0W5'><pre id='1j0W5'><center id='1j0W5'></center></pre></bdo></b><th id='1j0W5'></th></span></q></dt></tr></i><div id='1j0W5'><tfoot id='1j0W5'></tfoot><dl id='1j0W5'><fieldset id='1j0W5'></fieldset></dl></div>

        Java GC 安全点

        时间:2023-07-12
          <legend id='n81q5'><style id='n81q5'><dir id='n81q5'><q id='n81q5'></q></dir></style></legend>

          1. <small id='n81q5'></small><noframes id='n81q5'>

                <i id='n81q5'><tr id='n81q5'><dt id='n81q5'><q id='n81q5'><span id='n81q5'><b id='n81q5'><form id='n81q5'><ins id='n81q5'></ins><ul id='n81q5'></ul><sub id='n81q5'></sub></form><legend id='n81q5'></legend><bdo id='n81q5'><pre id='n81q5'><center id='n81q5'></center></pre></bdo></b><th id='n81q5'></th></span></q></dt></tr></i><div id='n81q5'><tfoot id='n81q5'></tfoot><dl id='n81q5'><fieldset id='n81q5'></fieldset></dl></div>

                  <bdo id='n81q5'></bdo><ul id='n81q5'></ul>

                  <tfoot id='n81q5'></tfoot>
                    <tbody id='n81q5'></tbody>
                  本文介绍了Java GC 安全点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  当垃圾收集器在清理未引用的对象之前冻结应用程序线程时,所有线程都必须在其执行过程中处于安全点".我发现了大量描述安全点概念的文章,但很少有例子.在典型的 Java 方法中,安全点应该放在哪里?为什么?更重要的是,哪里不能出现安全点?

                  When a garbage collector freezes the application threads before cleaning up unreferenced objects, all threads are required to be at a "safepoint" in their execution. I found a wealth of writing describing the concept of a safepoint, but very few examples. Where will a safepoint be placed within a typical Java method and why? And more importantly, where can a safepoint not occur?

                  推荐答案

                  safepoint 的确切定义和实现从一个 VM 实现到另一个,但是考虑到 Hotspot VM,你可以找到一个不错的定义在:HotSpot JVM 中的安全点.

                  The exact definition and implementation of a safepoint changes from one VM implementation to another, but considering Hotspot VM, you can find a nice definition in: Safepoints in HotSpot JVM.

                  HotSpot 词汇表 说:

                  程序执行过程中所有 GC 根都已知且所有堆对象内容一致的点.从全局的角度来看,所有线程都必须在 GC 运行之前阻塞在安全点.

                  A point during program execution at which all GC roots are known and all heap object contents are consistent. From a global point of view, all threads must block at a safepoint before the GC can run.

                  通常情况下,安全点是通过 JVM 向方法中注入安全点检查来实现的,大多数调用站点都符合安全点的条件 - 当到达安全点检查时,线程将检查是否需要安全点(例如调度 FullGC),如果是,然后线程阻塞.当 VM 中的所有线程都阻塞时,您已经到达了 VM 中的所有对象都可以完全访问的安全点.然后,执行请求安全点的 VM 操作(例如 FullGC),然后恢复线程.

                  Typically, the safepoint is implemented by JVM injecting a safepoint check into a method, most call sites qualify as safepoints - when reaching the safepoint check, the thread will check if the safepoint is required (e.g. FullGC is scheduled), if yes, then the thread blocks. When all the threads in the VM block, you have reached the safepoint where all the the objects in the VM are perfectly reachable. Then, the VM operation that requested the safepoint is performed (e.g. a FullGC), after that the threads are resumed.

                  检查需要安全点的 VM 操作列表:安全第一:安全点.

                  Check for the list of VM operations requiring a safepoint : Safety First: Safepoints.

                  您可以使用 -XX:+PrintSafepointStatistics –XX:PrintSafepointStatisticsCount=1 研究 Hotspot 中的安全点行为.

                  You can study safepoint behavior in Hotspot by using -XX:+PrintSafepointStatistics –XX:PrintSafepointStatisticsCount=1.

                  这篇关于Java GC 安全点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:“孤岛"垃圾收集 下一篇:-XX:-PrintGC 和 XX:-PrintGCDetails 标志有什么作用?

                  相关文章

                • <i id='OUh6y'><tr id='OUh6y'><dt id='OUh6y'><q id='OUh6y'><span id='OUh6y'><b id='OUh6y'><form id='OUh6y'><ins id='OUh6y'></ins><ul id='OUh6y'></ul><sub id='OUh6y'></sub></form><legend id='OUh6y'></legend><bdo id='OUh6y'><pre id='OUh6y'><center id='OUh6y'></center></pre></bdo></b><th id='OUh6y'></th></span></q></dt></tr></i><div id='OUh6y'><tfoot id='OUh6y'></tfoot><dl id='OUh6y'><fieldset id='OUh6y'></fieldset></dl></div>

                  <tfoot id='OUh6y'></tfoot>

                    <legend id='OUh6y'><style id='OUh6y'><dir id='OUh6y'><q id='OUh6y'></q></dir></style></legend>

                    <small id='OUh6y'></small><noframes id='OUh6y'>

                        <bdo id='OUh6y'></bdo><ul id='OUh6y'></ul>