Get JVM to grow memory demand as needed up to size of VM limit?

后端 未结 14 1402
渐次进展
渐次进展 2020-12-29 07:42

We ship a Java application whose memory demand can vary quite a lot depending on the size of the data it is processing. If you don\'t set the max VM (virtual memory) size

14条回答
  •  独厮守ぢ
    2020-12-29 08:09

    One more option... I work on a launcher called WinRun4J, which allows you to specify a max heap size as a percentage of the available memory on the machine its running on (ie. it does a check for the amount of memory available and sets the -Xmx parameter dynamically on startup).

    The INI option is "vm.heapsize.max.percent". There is also another option "vm.heapsize.preferred", which sets the -Xmx parameter as the maximum available memory on the machine up to this amount.

    I believe some of the other launchers (eg. Launch4J, Janel) offer the same functionality.

提交回复
热议问题