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

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

        当不再需要时,JVM 是否会将空闲内存返还给操作系统?

        Does the JVM give back free memory to the OS when no longer needed?(当不再需要时,JVM 是否会将空闲内存返还给操作系统?)
          <tfoot id='EspU8'></tfoot>
          <i id='EspU8'><tr id='EspU8'><dt id='EspU8'><q id='EspU8'><span id='EspU8'><b id='EspU8'><form id='EspU8'><ins id='EspU8'></ins><ul id='EspU8'></ul><sub id='EspU8'></sub></form><legend id='EspU8'></legend><bdo id='EspU8'><pre id='EspU8'><center id='EspU8'></center></pre></bdo></b><th id='EspU8'></th></span></q></dt></tr></i><div id='EspU8'><tfoot id='EspU8'></tfoot><dl id='EspU8'><fieldset id='EspU8'></fieldset></dl></div>

          <legend id='EspU8'><style id='EspU8'><dir id='EspU8'><q id='EspU8'></q></dir></style></legend>
            <bdo id='EspU8'></bdo><ul id='EspU8'></ul>
          • <small id='EspU8'></small><noframes id='EspU8'>

                    <tbody id='EspU8'></tbody>

                • 本文介绍了当不再需要时,JVM 是否会将空闲内存返还给操作系统?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个应用程序暂时需要一定数量的内存/堆用于某些进程.给定一个合理的 JVM 最大堆大小值作为选项,JVM 从一个小堆开始,并根据需要向操作系统请求更多内存.

                  I have an application that temporarily needs some certain amount of memory/heap for some processes. Given a reasonable value of maximum heap size to the JVM as an option, the JVM starts with a little heap and requests more memory from the OS on demand.

                  我的问题是,当我的应用程序不再需要太多内存时,JVM 是否会将额外的内存返还给操作系统(例如,用于其他进程).目前,我的应用程序似乎永远保留了该内存,即使不再需要.

                  My question is, if that additional memory will be given back by the JVM to the OS (e.g. for other processes) when there is no need for much memory anymore by my application. Currently my application seems to hold that memory forever, even when not needed anymore.

                  推荐答案

                  JVM确实将内存返回给操作系统,但只是很不情愿,因为它可能很快又需要它,而从操作系统获取内存是一个相对昂贵的操作.

                  The JVM does return memory to the OS, but only very reluctantly, since it may need it again soon, and getting memory from the OS is a relatively expensive operation.

                  如果您希望 JVM 更急切地将内存返回给操作系统,您可以使用 Oracle JVM的调优参数,具体是-XX:MaxHeapFreeRatio-XX:MinHeapFreeRatio

                  If you want the JVM to return memory to the OS more eagerly, you can use the tuning parameters of the Oracle JVM, specifically -XX:MaxHeapFreeRatio and -XX:MinHeapFreeRatio

                  这篇关于当不再需要时,JVM 是否会将空闲内存返还给操作系统?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 而不是增加堆?)
                  Why a sawtooth shaped graph?(为什么是锯齿形图形?)
                    <i id='h5XwX'><tr id='h5XwX'><dt id='h5XwX'><q id='h5XwX'><span id='h5XwX'><b id='h5XwX'><form id='h5XwX'><ins id='h5XwX'></ins><ul id='h5XwX'></ul><sub id='h5XwX'></sub></form><legend id='h5XwX'></legend><bdo id='h5XwX'><pre id='h5XwX'><center id='h5XwX'></center></pre></bdo></b><th id='h5XwX'></th></span></q></dt></tr></i><div id='h5XwX'><tfoot id='h5XwX'></tfoot><dl id='h5XwX'><fieldset id='h5XwX'></fieldset></dl></div>

                      • <tfoot id='h5XwX'></tfoot>
                          <tbody id='h5XwX'></tbody>
                          <bdo id='h5XwX'></bdo><ul id='h5XwX'></ul>

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

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