Setting JVM parameters at runtime

后端 未结 2 596
执笔经年
执笔经年 2020-12-08 07:30

Is it possible to change/modify/adding VM parameters after the JVM is already loaded (running)? If so, how can I do it?

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-08 08:08

    A short answer is that you cannot change VM parameters at runtime. The Runtime class does expose some options such max memory. The main parameters such as max memory should only be set by an admin type allowing management of resources when multiple JVMs co exist on a machine. Allowing one JVM to get greedy and ask for lots and lots more than it was allocated would kill this constraint.

提交回复
热议问题