Howto limit java application memory specially on a VPS

Posted by HostsVault | Posted in Tips-And-Tricks | Posted on 13-05-2009-05-2008

1

Many Java application users may face this problem that their java virtual machine JVM is eating alot of memory , infact Java is greedy when allocting memory it will try allocating all the memory it can so  and wil share it with  other instances but this is a problem specially when your on a VPS and have limited memory .

You can limit the amount of memory Java  application uses by using this command when compiling  your application :

/usr/local/jdk/bin/javac -J-Xmx”amount of ram”  application.java

so for example to allocate 128 MB RAM only you run

/usr/local/jdk/bin/javac -J-Xmx128 application.java

You can limit the amount of m This way your application wouldn’t allocate more than 128 MB RAM.

VN:F [1.9.20_1166]
Rating: 9.0/10 (8 votes cast)
VN:F [1.9.20_1166]
Rating: +3 (from 3 votes)
Howto limit java application memory specially on a VPS, 9.0 out of 10 based on 8 ratings
Be Sociable, Share!

Comments posted (1)

BigMIke…

I am So Lucky That I found your blog and great articles. I will come to your blog often for finding new great articles from your blog.I am adding your rss feed in my reader Thank you…

VA:F [1.9.20_1166]
Rating: 1.0/5 (1 vote cast)
VA:F [1.9.20_1166]
Rating: -1 (from 1 vote)

Write a comment