By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,826 Members | 2,384 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,826 IT Pros & Developers. It's quick & easy.

Java VM Heap

P: n/a
Hello,
do you guys know how to increase the maximum heap for the jvm?
I know about giving to apps args like:
-Xmx<size> set maximum Java heap size

But i would like to give to my VM maximum heap defaults.
Any application that will use my Vm is set as default to -Xmx256M; without
setting it manually for each app.

thnx!
Kimbuba.
Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
"kimbuba" <ki*************@yahoo.it> wrote in message news:<vn*******************@tornado.fastwebnet.it> ...
Hello,
do you guys know how to increase the maximum heap for the jvm?
I know about giving to apps args like:
-Xmx<size> set maximum Java heap size

But i would like to give to my VM maximum heap defaults.
Any application that will use my Vm is set as default to -Xmx256M; without
setting it manually for each app.

thnx!
Kimbuba.


It depends on your virtual machine.

Note how this is problematic: The goal of Java is to 'write once, run
anywhere.' If you have to tweak the VM, you begin to defeat this
principle. If you need hundreds of megs available stack space,
perhaps you should rework your code, removing some recursion and using
a queue instead, thereby eliminitating a stack space dependency.

---
Jared Dykstra
http://www.bork.org/~jared
Jul 17 '05 #2

P: n/a
nos

"Jared Dykstra" <dy******@hotmail.com> wrote in message
news:ba**************************@posting.google.c om...
"kimbuba" <ki*************@yahoo.it> wrote in message

news:<vn*******************@tornado.fastwebnet.it> ...
Hello,
do you guys know how to increase the maximum heap for the jvm?
I know about giving to apps args like:
-Xmx<size> set maximum Java heap size

But i would like to give to my VM maximum heap defaults.
Any application that will use my Vm is set as default to -Xmx256M; without setting it manually for each app.

thnx!
Kimbuba.


It depends on your virtual machine.

Note how this is problematic: The goal of Java is to 'write once, run
anywhere.' If you have to tweak the VM, you begin to defeat this
principle. If you need hundreds of megs available stack space,
perhaps you should rework your code, removing some recursion and using
a queue instead, thereby eliminitating a stack space dependency.

---
Jared Dykstra
http://www.bork.org/~jared


or you could convert local variables to fields
then they would be on the heap and not on the stack
Jul 17 '05 #3

P: n/a
Note how this is problematic: The goal of Java is to 'write once, run
anywhere.' If you have to tweak the VM, you begin to defeat this
principle.


Ok wait!
I begin to understand.
You mean that if i tweak my VM to -> 256M and the app i use is build for 64M
vms the app will never go behind that?

I mean, if i'm using eclipse and i start eclipse with more than 64M there
will be no improvments?
Because if eclipse goes over 64m one day, it will goes on Out of memory for
all the other standard users on all the world?

I thought that java went on I/O swapping when no more memory is available.
What you are telling me is that if the java memory goes over the allowed it
will crash in any case?

Thnx
(do you have some resources on memory and java?)


Jul 17 '05 #4

P: n/a
"kimbuba" <ki*************@yahoo.it> wrote in message news:<HJ******************@tornado.fastwebnet.it>. ..
Note how this is problematic: The goal of Java is to 'write once, run
anywhere.' If you have to tweak the VM, you begin to defeat this
principle.


Ok wait!
I begin to understand.
You mean that if i tweak my VM to -> 256M and the app i use is build for 64M
vms the app will never go behind that?

I mean, if i'm using eclipse and i start eclipse with more than 64M there
will be no improvments?
Because if eclipse goes over 64m one day, it will goes on Out of memory for
all the other standard users on all the world?

I thought that java went on I/O swapping when no more memory is available.
What you are telling me is that if the java memory goes over the allowed it
will crash in any case?

Thnx
(do you have some resources on memory and java?)

The goal is to simply use the stack space effectively. Use it but
don't abuse it.

As for memory allocation, the VM asks the OS for RAM. The underlying
OS can then choose to use virtual memory or tell the VM no more memory
is available. It is system dependant. The Java VM will not use swap
space to create more memory--that is beyond the scope of a virtual
machine.

There is a book by o'reilly called "Java Virtual Machine" (ISBN:
1-56592-194-1) that provides an overview of the VM. It's several
years old now however. I'm sure better resources exist.

---
Jared Dykstra
http://www.bork.org/~jared
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.