Skip to content

Increase the java heap space of a certain app

I have an application that I want to run it and gives it more heap memory. I run my application using this command in terminal: home/bin/hadoop jar $pathofjarfile parameter1 parameter2 but I don’t know how to allocate more heap memory when running this application? if anyone could please advise.



The easiest method to increase the heap space is using the -Xmx<SizeInGigs>g option to the JVM command. For example:

java -Xmx4g -jar $pathofjarfile parameter1 parameter2

Since you have a path to home/bin/myapp jar you will either need to modify the script/application launching the JVM to follow suite or ask about the specific application you are using (IE: JBoss, Tomcat, GlassFish, etc).

9 People found this is helpful