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

后端 未结 14 1400
渐次进展
渐次进展 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:24

    The max VM sizes indeed answer to that need (it sets the max value, but the VM will take only necessary, step by step), but if you need several configurations, besides supplying different "cmd" files, I don't really see a way (though i'll search a bit more)

    [edit] How about using a first program/script (or even another java program), which would check the available resources for the system, and then only call your program with the appropriate -Xm, according to what it retrieved from system ? That way it would adapt to machines, even if you don't know them before. Could be an idea...

    [second edit] Ok, this has been proposed already by skaffman, my bad.

提交回复
热议问题