aspose file tools*
The moose likes Beginning Java and the fly likes JVM memory auto configuration Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "JVM memory auto configuration" Watch "JVM memory auto configuration" New topic
Author

JVM memory auto configuration

Faiz Mohd.
Greenhorn

Joined: Mar 02, 2006
Posts: 2
Hi,
This is my very first visit to this saloon (my frnd suggested visiting place).I hope this is a friendly place.

when I say java Hello.java:
1. will the OS start a new JVM ? (prepare JVM, load it in momory & run it)
2. By default how much physical memory will JVM occupy?
3. can I check total memory available beforehand and allocate some % of it to the JVM? (like I have 512MB RAM every time I run the a java program can I ask JVM to occupy about 50% of memory?)
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
You can't "java Hello.java". You must compile "Hello.java" to "Hello.class" using the compiler, "javac". Then you can "java Hello".

The "java" command starts a new JVM to run your specified class. There are other ways to run Java applications, such as applets, application servers, custom launchers (JNI invocation interface) etc, but the "java" command is the main one to think about, as a beginner.

The JVM started by "java" command will take some memory for its own code, some for its internal data, some for loaded classes, some for stacks for local variables, and some for the heap on which your objects will be stored. There are parameters (e.g. "-Xmx") to the "java" command through which you can control stack size and heap size. The defaults will usually be fine for beginners, however.

To my knowledge, the "java" command cannot be told to take a percentage of the available memory. It's a nice idea - Sun, are you listening?! An advanced Java user could write their own launcher to do that, I guess.


Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JVM memory auto configuration