Why do Java throw the exception 'OutOfMemory' ?

R

Red Orchid

Sun has made the exception 'OutOfMemory' to be
under the control of Java VM.
Why?

Besides ..
Though Java VM has the options 'MinHeapFreeRatio' and
'MaxHeapFreeRatio', she has the option 'Xmx'.
Why is 'Xmx' needed ?


When a program has the trouble like 'OutOfMemory',
it is not a valid way to increase the value of 'Xmx'
because you are not very sure that the max memory
size of the program will be 'xxxx' MBytes.

Let's consider a program that shows the list of user data.
The max size of user data is unknown for the most part.
And the magnitude of data displayed on the program is
at the discretion of user. Therefore,
the max memory size of the program is not determinate.


I think that the exception like 'OutOfMemory' has to be
under the control of OS, not Java VM.


What is your comment ?
Thanks.
 
M

Mladen Adamovic

Red said:
I think that the exception like 'OutOfMemory' has to be
under the control of OS, not Java VM.

In that case if you have memory leaks (i.e. improper handling of the
linked list) one JVM can take all the memory.

If you have several Tomcat servers on one computer (round robin on dual
core computer) you have more JVM which cannot take as much memory as
they would like so there are advantages of that approaches.

But, I agree, in most cases it could be under the control of OS and to
give as much memory as available to JVM.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,539
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top