<bdo id='uQ57T'></bdo><ul id='uQ57T'></ul>
  • <tfoot id='uQ57T'></tfoot>

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

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

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

      2. 为什么是锯齿形图形?

        Why a sawtooth shaped graph?(为什么是锯齿形图形?)

          <legend id='mVj6j'><style id='mVj6j'><dir id='mVj6j'><q id='mVj6j'></q></dir></style></legend>
            <tbody id='mVj6j'></tbody>
          • <bdo id='mVj6j'></bdo><ul id='mVj6j'></ul>

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

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

                  本文介绍了为什么是锯齿形图形?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  当我使用 NetBeans 运行下面提到的代码时,分配的堆大小图类似于锯齿形状.我附上了 JVisualVM 的屏幕截图,它以锯齿形显示了堆分配图.该程序是一个打印Hello, World!"的简单无限循环.进入控制台.

                  When I run the below mentioned code using NetBeans, the allocated heap size graph resembles a sawtooth shape. I am attaching the screen capture from JVisualVM which shows the heap allocation graph in with a sawtooth shape. The program is a simple infinite loop printing "Hello, World!" into the console.

                  public class HelloWorld {
                      public static void main(String a[]){
                          while(true) {
                              System.out.println("Hello, World!");
                          }
                      }
                  }
                  

                  任何人都可以解释使用堆图形状背后的原因吗?

                  Can anyone explain the reason behind the shape of the graph of used heap?

                  PS:即使我在不使用 NetBeans 的情况下运行它也会发生这种情况,因此它很可能与 NetBeans 无关...

                  PS: This happens even if I run it without using NetBeans, so it is most likely not related to NetBeans...

                  推荐答案

                  堆使用中的锯齿模式可以解释为在调用System.out.println<的过程中创建了几个局部变量/code> 调用.最值得注意的是,在 Oracle/Sun JRE 中,在年轻代中创建了几个 HeapCharBuffer 实例,如下面使用 VisualVM 的内存分析器获得的快照所示:

                  The sawtooth pattern in the heap usage can be explained by the fact that several local variables are created during the invocation of the System.out.println invocation. Most notably in the Oracle/Sun JRE, several HeapCharBuffer instances are created in the young generation, as noted in the following snapshot obtained using the memory profiler of VisualVM:

                  有趣的是堆上存在的活动对象的数量.锯齿模式是由伊甸园空间填满时发生的年轻代垃圾收集周期产生的;由于程序中没有执行繁重的计算活动,JVM 能够执行多次循环迭代,从而导致伊甸园空间(4MB 大小)被填满.随后的年轻代收集周期会清除大部分垃圾;它几乎总是整个伊甸园空间,除非对象仍在使用中,如以下从 VisualVM 获得的 gc 跟踪所示:

                  The interesting bit is in the number of live objects that are present on the heap. The sawtooth pattern results from the young-gen garbage collection cycle that occurs when the eden space fills up; since there is no heavy computational activity performed in the program, the JVM is able to execute several iterations of the loop, resulting in the eden space (of 4MB is in size) filling up. The succeeding young-gen collection cycle then clears out most of the garbage; it is almost always the whole of the eden space, unless the objects are still in use, as indicated by the following gc trace obtained from VisualVM:

                  因此,锯齿模式的行为可以通过一系列快速连续的对象分配来解释,这些分配填满了伊甸园空间,触发了年轻一代垃圾回收周期;这个过程循环重复,没有延迟,因为底层 JVM 进程没有被另一个进程抢占,并且 JVM 中负责对象分配的主线程也没有被另一个线程抢占.

                  The behavior of the sawtooth pattern can thus be explained by a series of object allocations in rapid succession that fill up the eden space, triggering a young gen garbage collection cycle; this process repeats cyclically with no delays as the underlying JVM process is not preempted by another process, and the main thread within the JVM that is responsible for the object allocations is also not preempted by another thread.

                  这篇关于为什么是锯齿形图形?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Bytecode features not available in the Java language(Java 语言中不可用的字节码功能)
                  ClassCastException because of classloaders?(ClassCastException 因为类加载器?)
                  How can I add a Javaagent to a JVM without stopping the JVM?(如何在不停止 JVM 的情况下将 Javaagent 添加到 JVM?)
                  Cannot load 64-bit SWT libraries on 32-bit JVM ( replacing SWT file )(无法在 32 位 JVM 上加载 64 位 SWT 库(替换 SWT 文件))
                  Encourage the JVM to GC rather than grow the heap?(鼓励 JVM 进行 GC 而不是增加堆?)
                  Singleton across JVM or Application instance or Tomcat instance(跨 JVM 或 Application 实例或 Tomcat 实例的单例)

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

                  <legend id='7Re6H'><style id='7Re6H'><dir id='7Re6H'><q id='7Re6H'></q></dir></style></legend>

                  • <small id='7Re6H'></small><noframes id='7Re6H'>

                      <tbody id='7Re6H'></tbody>

                    <tfoot id='7Re6H'></tfoot>
                          • <bdo id='7Re6H'></bdo><ul id='7Re6H'></ul>