OutOfMemoryError in a separate Java thread OutOfMemoryError in a separate Java thread multithreading multithreading

OutOfMemoryError in a separate Java thread


One of the threads will throw OutOfMemoryError during the allocation part of a new. To avoid thrashing, there is likely to be a significant amount of memory free after the error is thrown. So the other threads can carry on, and are unlikely to OOME for a period.

If the OOME is not caught, then the thread will exit and the uncaught exception handler called. On exit the thread and associated objects will be available for garbage collection as usual (subject to not being referenced by other means).