aspose file tools*
The moose likes Java in General and the fly likes OutOfMemoryError: Java heap space Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "OutOfMemoryError: Java heap space" Watch "OutOfMemoryError: Java heap space" New topic
Author

OutOfMemoryError: Java heap space

Adrian Cordoba
Greenhorn

Joined: Jul 09, 2011
Posts: 15

Hi, all!

Can a Java VM remain running after a OutOfMemoryError: Java heap space?
Is that possible?
(I'm supporting Java applications, and that is they are reporting.)

Thank you, in advance.


[Adrián E. Córdoba]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39436
    
  28
Yes, if you delete whatever is in the memory.

Yes, if you don’t mind poor design like that.
Jinu Vijay
Greenhorn

Joined: Sep 19, 2011
Posts: 20

Following on what Campbell mentions (very crisply!!!) ...

You have 2 options that you could work on:
1. Remedy the situation by increasing the heap size using the JVM option -Xmx512M
2. Use some profiler to analyse your application code to find the source of the memory leakage and fix it asap!

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42292
    
  64
Jinu Vijay wrote:Use some profiler to analyse your application code to find the source of the memory leakage

This assumes that there is a leak. It could just be that the app needs that much memory (or that the algorithms currently used by the app need that much memory).


Ping & DNS - my free Android networking tools app
Jinu Vijay
Greenhorn

Joined: Sep 19, 2011
Posts: 20

Ulf Dittmer wrote:
Jinu Vijay wrote:Use some profiler to analyse your application code to find the source of the memory leakage

This assumes that there is a leak. It could just be that the app needs that much memory (or that the algorithms currently used by the app need that much memory).


Indeed an assumption, but that based on experience! 2 reasons:
1. Production systems typically have more that enough resources
2 Ask support teams ... it always the development team's code that is faulty

Cheers!

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39436
    
  28
Jinu Vijay wrote: . . .
2 Ask support teams ... it always the development team's code that is faulty

Cheers!

William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12806
    
    5
Can a Java VM remain running after a OutOfMemoryError: Java heap space?


Throwing that Error could have left an application in a complete mess - best practice is to not try to continue running.

Bill
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: OutOfMemoryError: Java heap space