Pages Navigation Menu

Coding is much easier than you think

Catching out of memory error in java

Posted by on Feb 24, 2013 in Java, JVM | 1 comment

 
Catching out of memory error in java
 
Catching out of memory error in java
 
You can catch it as it descends from Throwable:
 

try {
    // create lots of objects here and stash them somewhere
} catch (OutOfMemoryError E) {
    // release some (all) of the above objects
}

 

Advertisements
Read More