I strongly recommend to reduce the unnecessary use of abbreviation. While it’s clear that “OOM” refers to OutOfMemoryError
, the meaning of “EOF” and “SOF” is not. “EOF” normally refers to “end of file” which does not apply here. “SOF” could refer to StackOverflow
, but that’s rather unusual. I don’t think that writing the full names of the errors would take too much of your lifetime.
Regarding OutOfMemoryError
, the answer is that it is implementation dependent.
The JVM specification, §2.5.2. Java Virtual Machine Stacks, says
The following exceptional conditions are associated with Java Virtual Machine stacks:
- If the computation in a thread requires a larger Java Virtual Machine stack than is permitted, the Java Virtual Machine throws a
StackOverflowError
.
- If Java Virtual Machine stacks can be dynamically expanded, and expansion is attempted but insufficient memory can be made available to effect the expansion, or if insufficient memory can be made available to create the initial Java Virtual Machine stack for a new thread, the Java Virtual Machine throws an
OutOfMemoryError
.
So in principle, an OutOfMemoryError
can be thrown under certain circumstances, but the widespread HotSpot JVM doesn’t support dynamic stack expansion so this will never be a cause for an OutOfMemoryError
.
The creation of a new Thread
may fail with an OutOfMemoryError
, but since there are several allocations involved, including the Thread
instance on the heap, it hardly ever matters whether the failed allocation was supposed to provide the stack memory of the new thread or serve some other purpose.