单例设计模式
938 2023-04-03 03:56:49
java.lang.OutOfMemoryError: Java heap space
java.lang.OutOfMemoryError: PermGen spacejava.lang.OutOfMemoryError: Metaspace
Why does the memory usage increase when I redeploy a web application? That is because your web application has a memory leak. A common issue are “PermGen” memory leaks. They happen because the Classloader (and the Class objects it loaded) cannot be recycled unless some requirements are met (). They are stored in the permanent heap generation by the JVM, and when you redeploy a new class loader is created, which loads another copy of all these classes. This can cause OufOfMemoryErrors eventually. (*) The requirement is that all classes loaded by this classloader should be able to be gc’ed at the same time.
java.lang.OutOfMemoryError:GC overhead limit exceeded
java.lang.OutOfMemoryError : unable to create new native Thread
java.lang.OutOfMemoryError: Requested array size exceeds VM limit
这种情况一般是由于不合理的数组分配请求导致的,在为数组分配内存之前,JVM 会执行一项检查。要分配的数组在该平台是否可以寻址(addressable),如果不能寻址(addressable)就会抛出这个错误。解决方法就是检查你的代码中是否有创建超大数组的地方。java.lang.OutOfMemoryError: Out of swap space
这种情况一般是操作系统导致的,可能的原因有:1、swap 分区大小分配不足;2、其他进程消耗了所有的内存。解决方案:1、其它服务进程可以选择性的拆分出去 2、加大swap分区大小,或者加大机器内存大小java.lang.OutOfMemoryError: stack_trace_with_native_method
本地方法在运行时出现了内存分配失败,和之前的方法栈溢出不同,方法栈溢出发生在 JVM 代码层面,而本地方法溢出发生在JNI代码或本地方法处。这个异常出现的概率极低,只能通过操作系统本地工具进行诊断,难度有点大,还是放弃为妙。