使用 32 位 JRockit R 28.2.4-14 运行的 Weblogic 10.3.5-Xmx1024m -Xms1024m
在我们的 Java EE EAR 文件的 5-8 次取消部署-重新部署周期后总是会耗尽本机内存。
根据错误信息和 VisualVM 中显示的内容,不是 Java 堆太满,而是可用的系统内存不足。
java.lang.OutOfMemoryError: class allocation, 865324184 loaded, 464M footprint,
in check_alloc (src/jvm/model/classload/classalloc.c:215).
Attempting to allocate 1G bytes
There is insufficient native memory for the Java
Runtime Environment to continue.
Possible reasons:
The system is out of physical RAM or swap space
In 32 bit mode, the process size limit was hit
Possible solutions:
Reduce memory load on the system
Increase physical memory or swap space
Check if swap backing store is full
Use 64 bit Java on a 64 bit OS
Decrease Java heap size (-Xmx/-Xms)
Decrease number of Java threads
Decrease Java thread stack sizes (-Xss)
Disable compressed references (-XXcompressedRefs=false)
at sun.misc.Unsafe.defineClass(Native Method)
at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:45)
at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:381)
at sun.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:377)
at sun.reflect.MethodAccessorGenerator.generateSerializationConstructor(MethodAccessorGenerator.java:95)
at sun.reflect.ReflectionFactory.newConstructorForSerialization(ReflectionFactory.java:313)
at java.io.ObjectStreamClass.getSerializableConstructor(ObjectStreamClass.java:1322)
我理解建议的可能解决方案,但是如果应用程序只部署一次,一切都很好,在取消部署时似乎没有正确释放类。取消部署后的堆转储显示我们的许多类留在内存中。那他们不应该被垃圾收集吗?
GC Root 的路径显示一个 Thread <JNI Local> java.lang.Thread @ 0x129ac778 JDWP Transport Listener: dt_socket Native Stack, Thread
。服务器上没有流量,我不知道为什么它保持活跃。