Howto limit java application memory specially on a VPS

Posted by HostsVault | Posted in How-To's | 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.3_1094]
Rating: 8.4/10 (5 votes cast)
VN:F [1.9.3_1094]
Rating: +2 (from 2 votes)
Howto limit java application memory specially on a VPS, 8.4 out of 10 based on 5 ratings
Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Furl
  • Slashdot
  • StumbleUpon
  • Technorati

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.3_1094]
Rating: 0.0/5 (0 votes cast)
VA:F [1.9.3_1094]
Rating: 0 (from 0 votes)

Write a comment