Since 1.5 the OutOfMemoryError object contains a descriptive reason:
try
{
OOM(); //too much memory is being allocated in here
}
catch (OutOfMemoryError oome)
{
System.err.println(oome);
Runtime.getRuntime().halt(1);
}
1.5 gives this:
java.lang.OutOfMemoryError: Java heap space
while for 1.4.2 the same is less informative:
java.lang.OutOfMemoryError
It would be nice to backport the 1.5 functionality to 1.4.2 if it's
not too complex.
try
{
OOM(); //too much memory is being allocated in here
}
catch (OutOfMemoryError oome)
{
System.err.println(oome);
Runtime.getRuntime().halt(1);
}
1.5 gives this:
java.lang.OutOfMemoryError: Java heap space
while for 1.4.2 the same is less informative:
java.lang.OutOfMemoryError
It would be nice to backport the 1.5 functionality to 1.4.2 if it's
not too complex.
- duplicates
-
JDK-4546163 OutOfMemoryError is too generic, there should be several with different messages
-
- Closed
-