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.
- Outofmemoryerror: GC overhead limit exceeded solution
- Error in idea compilation: java.lang.OutOfMemoryError Java heap space and java.lang.StackOverflowError
- SBT command package error solution
- Java:java.lang.OutOfMemoryError : GC overhead limit exceeded solution
- Error report in idea compilation Error:Android Dex : [Project] java.lang.OutOfMemoryError : GC overhead limit exceeded
- How many pieces of data can list store in Java?
- Causes and solutions of classnotfoundexception / NoClassDefFoundError
- glassfish:Resource temporarily unavailable in tsStartJavaThread
- Summary of common runtimeException exceptions
- VC Critical error detected c0000374 crash problem and solution
- Yarn: runtime.ContainerExecutionException : launch container failed
- JVM start error: could not reserve enough space for object heap error
- The difference between classnotfoundexception and NoClassDefFoundError
- Error occurred during initialization of VM Could not reserve enough space for object heap
- Record once the solution of gradle dependency problem: failed to determine a suitable driver class
- Resolve rabbitmq declarationexception: failed to declare queue exception
- How to Fix stack overflow error
- BUG: Bad page map in process XXX pte:800000036fae6227 pmd:35be8c067
- The difference between sleep() and wait() in Java
- Eclipse run main method error: a JNI error has occurred, please check your installation and try again