<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 是否会将空闲内存返还给操作系统?

        时间:2023-08-24
          <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 是否会将空闲内存返还给操作系统?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Hotspot JIT 编译器是否有任何可以重现的指令重新排序? 下一篇:CompressedClassSpaceSize 区域是否包含 MaxMetaspaceSize 区域?

                  相关文章

                  <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>

                  1. <tfoot id='h5XwX'></tfoot>
                      <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>