This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes what is the default size of java heap Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "what is the default size of java heap " Watch "what is the default size of java heap " New topic
Author

what is the default size of java heap

SivaRamiReddy Reddy
Greenhorn

Joined: Aug 14, 2006
Posts: 4
Please can you tell the default java heap
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
From the 5.0 documentation for the windows java application launcher:
-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


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
SivaRamiReddy Reddy
Greenhorn

Joined: Aug 14, 2006
Posts: 4
How do we set our own heap heap memory size
Brian Mozhdehi
Ranch Hand

Joined: Aug 17, 2006
Posts: 81
You use what Barry stated in is post, which is done at the point where you invoke your program, i.e.

if you invoke your program now using

java <yourclass>

do it like this (for example)

java -Xms32m -Xmx128m <yourclass>

which would start the engine with a minimum size of 32M and a maximum size of 128M

(changed order)
[ August 19, 2006: Message edited by: Barry Gaunt ]
Bert Bates
author
Sheriff

Joined: Oct 14, 2002
Posts: 8879
    
    5
I'll leave it here, but everyone should know that this very interesting discussion will NOT be on the exam.


Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: what is the default size of java heap