I tried to experiment with the jcmd option VM.set_flag. But I came across one mistake saying that "only" writable "flags" can be set. What are recordable flags?
Getting my pid:
XXX@XXX-Air :~/javacode$ jcmd -l 6294 Test 6295 jdk.jcmd/sun.tools.jcmd.JCmd -l
Trying to change vm flags:
XXX@XXX-Air :~/javacode$ jcmd 6294 VM.set_flag ConcGCThreads 4 6294: only 'writeable' flags can be set XXX@XXX-Air :~/javacode$ jcmd 6294 VM.set_flag MaxNewSize 1G 6294: only 'writeable' flags can be set
Edit: it worked for managed flags, below are successful teams.
XXXX@XXX-Air :~/javacode$ jcmd 11441 VM.flags -all | grep MinHeapFreeRatio uintx MinHeapFreeRatio = 40 {manageable} {default} XXXX@XXX-Air :~/javacode$ jcmd 11441 VM.set_flag MinHeapFreeRatio 45 11441: Command executed successfully XXXX@XXX-Air :~/javacode$ jcmd 11441 VM.flags -all | grep MinHeapFreeRatio uintx MinHeapFreeRatio = 45
source share