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

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

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

        <tfoot id='z2vbd'></tfoot>

        如何禁用 Java 垃圾收集器?

        时间:2023-07-12

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

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

                <bdo id='nJhnc'></bdo><ul id='nJhnc'></ul>
                  <tbody id='nJhnc'></tbody>
                  本文介绍了如何禁用 Java 垃圾收集器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我们有一个 PHP webapp,它调用 Java 二进制文件来生成 PDF 报告(使用 JasperReports).Java 二进制文件将 PDF 输出到标准输出并退出;然后 PHP 将 PDF 发送到浏览器.这个 Java 命令持续大约 3 到 6 秒,我认为当它持续 6 秒时,这是因为 GC 启动了.我想禁用 GC,因为无论如何,当命令退出时,所有内存都会返回.

                  We have a PHP webapp that calls a Java binary to produce a PDF report (with JasperReports). The Java binary outputs the PDF to standard output and exits; the PHP then sends the PDF to browser. This Java command lasts about 3 to 6 seconds, and I think when it lasts 6 second it's because the GC kicks in. I would like to disable the GC because anyway when the command exits all memory is returned.

                  我想知道如何为 Java 1.4.2 和 Java 1.6.0 禁用它,因为我们目前正在测试这两个 JVM 以查看哪个执行得更快..

                  I would like to know how to disable it for Java 1.4.2 and for Java 1.6.0 because we are currently testing both JVM to see which performs faster..

                  推荐答案

                  没有办法完全禁用垃圾回收.垃圾收集仅在 JVM 空间不足时运行,因此您可以为程序提供更多内存.将这些命令行选项添加到 Java 命令中

                  There is no way to disable garbage collection entirely. Garbage collection is only run when the JVM runs out of space, so you could give the program more memory. Add these command line options to the Java command

                  -Xmx256M -Xms256M
                  

                  这为程序提供了 256Mb 的内存(默认为 64Mb).但是,对于默认大小的 JVM,垃圾收集不会花费 3 秒,因此您可能需要更仔细地调查程序在做什么.Yourkit profiler 对于找出需要很长时间的事情非常有用.

                  This gives the program 256Mb of ram (the default is 64Mb). Garbage collection will not take 3 seconds for a default size JVM though, so you might want to investigate more closely what the program is doing. Yourkit profiler is very useful for figuring out what is taking a long time.

                  这篇关于如何禁用 Java 垃圾收集器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在生产环境中设置 -XX:+DisableExplicitGC:会出现什么问题? 下一篇:什么是类的 GC 根?

                  相关文章

                  • <bdo id='HVqET'></bdo><ul id='HVqET'></ul>
                  1. <tfoot id='HVqET'></tfoot>

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

                  2. <small id='HVqET'></small><noframes id='HVqET'>

                  3. <legend id='HVqET'><style id='HVqET'><dir id='HVqET'><q id='HVqET'></q></dir></style></legend>