强制jvm返回原生内存 [英] force jvm to return native memory
问题描述
我试过 Max / MinHeapFreeRatio
参数,以强制jvm减少未使用的内存的消耗。那是我的eclipse config.ini
文件:
-startup
plugins / org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
plugins / org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502
-vm
c:/ Program Files / Java / jdk1.6.0_26 / bin / javaw.exe
-showlocation
-product
org.eclipse.epp.package。 jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Duser.name = Michael Nesterenko
-Dosgi.requiredJavaVersion = 1.5
-Xms512m
-Xmx4096m
-XX:MinHeapFreeRatio = 10
-XX:MaxHeapFreeRatio = 30
但是这没有帮助,我仍然有很多未使用的内存的情况。
当Java启动时,Java会分配最大堆大小ual记忆由于它使用内存,它被分配为真正的主内存。它从未缩小这个尺寸。释放此内存的唯一方法是程序退出。
Java将压缩其内存使用量,以前使用的许多页面可以交换到磁盘,不过,如果再次需要它,这可能会有很大的性能。
I am running from time to time in eclipse tasks that require very big amount of memory. So jvm while task is running swallows about 2-3gb of RAM, that is ok. But once jvm took that memory it does not release it and I have a situation when used memory in the heap is about 200mb with total heap size about 3gb and that is really unwanted as other programs are starving for memory.
I tried Max/MinHeapFreeRatio
parameters to force jvm to reduce consumption of an unused memory. That is my eclipse config.ini
file:
-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502
-vm
c:/Program Files/Java/jdk1.6.0_26/bin/javaw.exe
-showlocation
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Duser.name=Michael Nesterenko
-Dosgi.requiredJavaVersion=1.5
-Xms512m
-Xmx4096m
-XX:MinHeapFreeRatio=10
-XX:MaxHeapFreeRatio=30
But that does not help, I still have situations when there are lots of unused memory.
Java allocates the maximum heap size when it starts as virtual memory. As it uses the memory it get allocated as real main memory. It never shrinks this size. The only way to release this memory is for the program to exit.
Java will compact its memory usage so many of the pages it has used before can be swapped to disk, however this can have a significant performance hit if it needs them again.
这篇关于强制jvm返回原生内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!