• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JVM Ram settings

 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there an option or property that will allow me to set the JVMs memory usage ? Can i say to the JVM - "hey ! i am only going to allow you 120MB of ram".
 
Rajah Nagur
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
-Xmsn
Specify the initial size, in bytes, of the memory allocation pool. This value must be a multiple of 1024 greater than 1MB. Append the letter k or K to indicate kilobytes, or m or M to indicate megabytes. The default value is 2MB. Examples:

-Xms6291456
-Xms6144k
-Xms6m


-Xmxn
Specify the maximum size, in bytes, of the memory allocation pool. This value must a multiple of 1024 greater than 2MB. Append the letter k or K to indicate kilobytes, or m or M to indicate megabytes. The default value is 64MB. Examples:

-Xmx83886080
-Xmx81920k
-Xmx80m

Check this site
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15369
40
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So John, in your case you want to use this:

java -Xmx120m com.mypackage.MyProgram

Which means that the JVM will not allocate more than 120 MB RAM. If your Java program tries to use more, it will get an OutOfMemoryException.
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thats cool. I wanted to know if one could set this limit. Now i know.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic