A note of what I researched when studying Java Silver.
Class StackOverflowError Error caused by running out of memory in ** stack area **
[Example of situations that occur] Make a ** recursive call ** within a method
[What is the stack area] A memory area that stores ** local variable and method information **. As the name suggests, it has a stack-like data structure (last-in, first-out method).
If you keep calling your own method in the method, the method information will accumulate in the stack area and you will get a flat tire. Then, the JVM (Java Virtual Machine) detects that the stack area is insufficient and raises a StackOverflowError.
Thrown when the Java Virtual Machine is unable to allocate an object due to lack of memory and the garbage collector cannot allocate any more available memory.
Error caused by running out of memory in ** heap area **
[Example of situations that occur] ** Infinite loop ** is happening (Reference: Understanding OutOfMemoryError Exceptions)
[What is a heap area] An area for storing ** instance ** information.
StackOverflowError occurs when the memory (stack) allocated to the JVM is full. If the JVM fails to allocate memory, an OutOfMemoryError will occur.
-What is a heap area? Explain the difference from the stack area and the specific management method!
・ [What is the stack area](http://www.kab-studio.biz/Programing/JavaA2Z/Word/00000987.html#:~:text=%E3%83%A1%E3%83%A2%E3% 83% AA% E4% B8% 8A% E3% 81% AE% E3% 80% 81% E3% 83% AD% E3% 83% BC% E3% 82% AB% E3% 83% AB% E5% A4% 89% E6% 95% B0,% E6% A0% BC% E7% B4% 8D% E3% 81% 99% E3% 82% 8B% E9% A0% 98% E5% 9F% 9F% E3% 81% AE % E3% 81% 93% E3% 81% A8% E3% 80% 82 & text = JVM% E3% 81% 8C% E4% BD% BF% E7% 94% A8% E3% 81% 99% E3% 82% 8B % E3% 83% A1% E3% 83% A2% E3% 83% AA,% E7% 8A% B6% E3% 81% AB% E6% A0% BC% E7% B4% 8D% E3% 81% 95% E3% 82% 8C% E3% 82% 8B% E3% 80% 82)
Recommended Posts