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

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

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

      使用 live 选项时,jmap 是否强制进行垃圾收集?

      时间:2023-07-12

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

        • <legend id='h1frk'><style id='h1frk'><dir id='h1frk'><q id='h1frk'></q></dir></style></legend>

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

                本文介绍了使用 live 选项时,jmap 是否强制进行垃圾收集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我今天一直在试验 jmap -histojmap -dump

                I've been experimenting with jmap -histo and jmap -dump today

                按此顺序运行时

                jmap -dump:format=b,file=heap.1 [pid]
                jmap -dump:live,format=b,file=heap.2 [pid]
                jmap -dump:format=b,file=heap.3 [pid]
                

                heap.3 更类似于 heap.2 而不是 heap.1.特别是,我对 heap.1 感兴趣的死"对象在 heap.3 中不存在.

                heap.3 resembles heap.2 more than heap.1. In particular, the "dead" objects that I'm interested in in heap.1 are absent from heap.3.

                看到这一点,我开始寻找能够告诉我应该期待什么的文档.我设法得到的最接近的是 this discussion,briand 和 alanb 的评论在实践中暗示了这一点当我使用 live 选项时,我可以预期会发生此 GC;但答案是五年前的事了,论坛上的帖子似乎有点非正式的规范.

                Seeing this, I started looking for documentation that would tell me what I should expect. The closest I managed to get was this discussion, where the comments from briand and alanb imply that in practice I can expect this GC to occur when I use the live option; but the answers are five years old, and posts to a forum seem a bit informal for a specification.

                在哪里可以找到记录的当前行为?

                Where can I find the current behavior documented?

                推荐答案

                为了确定 liveness,Java 必须运行 full GC,所以是的,它确实如此.

                In order to determine liveness, Java has to run full GC, so yes, it does.

                为了让问题沉睡......如果有人需要更深入地挖掘,这就是答案.随意.

                To put the question to sleep... here is the answer, if anyone needs to dig deeper. Feel free.

                /hotspot/agent/src/share/vm/services/attachListener.cpp的一部分取自

                openjdk http://download.java.net/openjdk/jdk7/并且您必须接受 http://www.gnu.org/licenses/gpl-2.0.html

                openjdk http://download.java.net/openjdk/jdk7/ and you must accept http://www.gnu.org/licenses/gpl-2.0.html

                // Implementation of "inspectheap" command
                //
                // Input arguments :-
                //   arg0: "-live" or "-all"
                static jint heap_inspection(AttachOperation* op, outputStream* out) {
                  bool live_objects_only = true;   // default is true to retain the behavior before this change is made
                  const char* arg0 = op->arg(0);
                  if (arg0 != NULL && (strlen(arg0) > 0)) {
                    if (strcmp(arg0, "-all") != 0 && strcmp(arg0, "-live") != 0) {
                      out->print_cr("Invalid argument to inspectheap operation: %s", arg0);
                      return JNI_ERR;
                    }
                    live_objects_only = strcmp(arg0, "-live") == 0;
                  }
                  VM_GC_HeapInspection heapop(out, live_objects_only /* request full gc */, true /* need_prologue */);
                  VMThread::execute(&heapop);
                  return JNI_OK;
                }
                

                在 vmGCOperations.hpp 中是定义

                `VM_GC_HeapInspection(outputStream* out, bool request_full_gc,
                                   bool need_prologue) :`
                

                这篇关于使用 live 选项时,jmap 是否强制进行垃圾收集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:何时以及如何将 java 类加载器标记为垃圾收集? 下一篇:在 Java 中替换 finalize()

                相关文章

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

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

                  2. <legend id='WlHXX'><style id='WlHXX'><dir id='WlHXX'><q id='WlHXX'></q></dir></style></legend>
                  3. <tfoot id='WlHXX'></tfoot>
                    <i id='WlHXX'><tr id='WlHXX'><dt id='WlHXX'><q id='WlHXX'><span id='WlHXX'><b id='WlHXX'><form id='WlHXX'><ins id='WlHXX'></ins><ul id='WlHXX'></ul><sub id='WlHXX'></sub></form><legend id='WlHXX'></legend><bdo id='WlHXX'><pre id='WlHXX'><center id='WlHXX'></center></pre></bdo></b><th id='WlHXX'></th></span></q></dt></tr></i><div id='WlHXX'><tfoot id='WlHXX'></tfoot><dl id='WlHXX'><fieldset id='WlHXX'></fieldset></dl></div>