For logging anything in a catch block, we need text which is a String object but JVM has already run out of memory. Two possible reasons which I can think of are:
- OutOfMemory error signifies heap space and String object can be saved in String pool.
- OutOfMemory error signifies that very little space is left in contrast to heap is completely full and that very little space is available for storing the string to be logged.