I am trying to increase the java heap memory in our production server . Here is the two way by which I am trying .
Way 1
I have tried the following answer from this link. I have set java memory by the following command .
export _JAVA_OPTIONS="-Xmx10g"
java -XshowSettings:vm
In this way , java heap size is not permanently increased .
Way 2
I have tried this answer. I have tried to increase java heap size by the following command .
java -XX:+PrintFlagsFinal -Xms5240m -Xmx10240m -Xss512k -XX:PermSize=64m -XX:MaxPermSize=128m -version | grep -iE 'HeapSize|PermSize|ThreadStackSize
In this way , java heap size is not permanently increased .
Conclusion
In the above way , I could not be succeeded to change java heap size permanently . So how can I change java heap size permanently ? Please suggest me a way . Thanks in advance.
Updated :
Here I want to mean the following meaning by 'permanently' word .
Meaning : If I run the following command , then I want to see the heap size same every time I open the shell .
java -XX:+PrintFlagsFinal -version | grep -iE'HeapSize|PermSize|ThreadStackSize'