Search code examples
javajvmjvm-arguments

Can I change JVM parameters during execution


I am writing a Java program and at some point during execution I want to change the JVM settings (decrease the heap) and after a while increase it again. Is it possible with Java?


Solution

  • Long story short: you can't. Heap size is fixed once you are running it, and there's no way to modify it from the code.