Not sure, but I think it's better to rethrow the OutOfMemoryError after it fails for the second time. Swallowing that Error will probably make the JVM unstable afterwards.