1, StackOverflow: Whenever a Java program starts a new thread, the Java virtual machine allocates a stack for it, and the Java stack keeps the thread running in frames. When a thread calls a method, the JVM presses a new stack frame onto the thread’s stack, and the stack frame exists as long as the method has not returned.
if the method has too many layers of nested calls (such as recursive calls), as the number of frames in the Java stack increases, the total size of all stack frames in the stack of this thread will eventually be greater than the value set by -xss, resulting in a StackOverflowError overflow exception. When the Java program starts a new thread, there is not enough space to allocate the Java stack for the thread. The size of a thread’s Java stack is determined by the -XSS setting. The JVM throws an OutOfMemoryError exception. The Java heap is used to store instances of objects. When it is necessary to allocate memory for instances of objects, and the heap occupation has reached the maximum set value (via -Xmx), OutOfMemoryError will be thrown. The method area is used to store information about Java classes, such as class names, access modifiers, constant pools, field descriptions, method descriptions, and so on. As the class loader loads the class file into memory, the JVM extracts the class information and places it in the method area.
when the class information needs to be stored and the method area has reached its maximum memory footprint (via -xx :MaxPermSize); An OutOfMemoryError exception will be thrown for tests in this case, the basic idea being that the runtime generates a large number of classes to fill the method area until it overflows. You need to manipulate the bytecode runtime directly with the help of CGLib to generate a large number of dynamic classes.
Read More:
- Tomcat memory overflow in Eclipse: Java. Lang. outofmemoryerror: permgen space solution:
- How to Fix stack overflow error
- Java:java.lang.OutOfMemoryError : GC overhead limit exceeded solution
- OpenGL runtime returned 1283 (stack overflow) error
- Error in idea compilation: java.lang.OutOfMemoryError Java heap space and java.lang.StackOverflowError
- Namenode startup error: outofmemoryerror: Java heap space
- Differences between Java and kotlin access modifiers
- Java. Lang. outofmemoryerror when using idea build project
- Error when idea starts: Java: outofmemoryerror: insufficient memory
- Error report in idea compilation Error:Android Dex : [Project] java.lang.OutOfMemoryError : GC overhead limit exceeded
- Use jstack to output the stack information in Java process to the specified file and analyze it
- Outofmemoryerror: GC overhead limit exceeded solution
- Ror deployed to heroku has application error and code = H10 desc = “app crashed” problems
- gyp ERR! build error gyp ERR! stack Error: `make` failed with exit code: 2 gyp ERR! stack at ChildPr
- Differences between the assets directory in Android project and the purpose of resource
- Differences between VI and VIM in Linux
- Oci-22053: overflow error problem
- Detailed explanation of UART, SPI and IIC and their differences and relations
- JNI ERROR global reference table overflow [How to Solve]
- Differences between length() size() and C strlen() of C + + string member functions