• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Is outOfMemory error always logged

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear all,

Our Java application (uses SWing,net and other standard packages)suddenlty quits with out a trace. We are aware of the fact that we are facing OutOfMemory probelm. Does java guarantee that OutOfMemory error will always be logged? Or is it possible that the application will quit with out logging OutOfMemory error due to non-availablity of memory even for the log action?

Thanks in advance
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your application is more likely to hang rather than exit with this exception.
 
Ranch Hand
Posts: 582
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
According to my experience, we cannot do anything when JVM raises OutOfMemory error.
The application will quit automatically and we can see the stacktrace about that error..

Correct me if I am wrong...
daniel
 
sarveswaran meenakshi sundaram
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,

Thanks for the replies.

I'm getting in to the details. In our application, when ever an exception occurs, we capture it, open a file, log the exception in the file, then close the file. When OutOfMemory error occurs, is it guranteed that all the actions that I have specified here will occur so that the exception is logged in our exception file? Or is it possible that the application may quit with out logging the exception in the file due to the non availablity of memory for the set of we have follow to log exceptions in our file?
 
Ranch Hand
Posts: 1970
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First, OutOfMemoryError is an Error, not an Exception. If you only catch Exception, you will not catch OutOfMemoryError.

Second, trying to respond to OutOfMemoryError is difficult. It can happen at any time, so your data structures may be broken. Also, if your attempt to handle OutOfMemoryError tries to allocate memory (e.g. write to a log file), then that may cause another OutOfMemoryError.

Third, various versions of the JVM have various bugs that mean that OutOfMemoryError does not always get thrown, when it ought to. Sometimes, the JVM crashes or exits instead.

Lastly, the JVM can run occasionally out of other memory-type resources than Java heap. This can cause various problems.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic