One of the threads will throw OutOfMemoryErrorwhile the item is being selected new. To avoid interruptions, it is possible that after the error a significant amount of free memory will be freed. Thus, other threads can continue and are unlikely to be OOME for a certain period of time.
If OOME is not caught, the thread will exit and call the uncaught exception handler. Upon exit, the stream and its associated objects will be available for garbage collection, as usual (without reference in other ways).
source
share