Before posting this question I have gone through post java increase xmx dynamically at runtime but answer given to this question not making me satisfy to know the reason.
I have an java application which takes a encrypted and compressed json string from an ESB server then application decrypt and uncompress the json string to a list of object. We published java application with Xms 256m
and Xmx 720m
but still sometime we get OutOfMemory exception cause to exception is while decrypt and uncompress the string all the memory get filled. lots of code review and optimization are done but as we don't have control on data sent by ESB sometime time it may be just of KBs and sometime may of MBs.
In this case dynamically increasing the memory will help.
I know there is no option to increase Xmx dynamically, but why? and about answer :
To prevent JVM from consuming the entire machine's free memory.
If machine having free memory then why not to use it?