In Java, is there a way to know that a StackOverflow error or OutOfMemory exception may happen soon?
StackOverflow
OutOfMemory
The OutOfMemory exception m
You can anticipate out-of-memory conditions with Runtime.freeMemory() and Runtime.maxMemory(). Most times it'll be hard recovering gracefully, but I leave that to you.