我用Java反射在这样的代码:java.lang.OutOfMemoryError:PermGen的空间:Java反射
Method method = LogFactory.class.getDeclaredMethod("getContextClassLoader");
method.setAccessible(true);
ClassLoader classLoader = (ClassLoader)method.invoke(null);
LogFactory.release(classLoader);
我用jprofiler
可以看到这样sun.reflect.GeneratedMethodAccessor11
这些类每增加了许多类电话
sun.reflect.BootstrapConstructorAccessorImpl
sun.reflect.NativeConstructorAccessorImpl
sun.reflect.DelegatingConstructorAccessorImpl
sun.reflect.DelegatingClassLoader
我想这就是为什么PermGen空间增加了,如何清理这些类?
为什么不创造更多的烫发空间? – StarPinkER 2013-04-21 10:41:31
也许我应该做更多的测试,我使用eclipse调试代码和jprofiler附加它。 – Fatkun 2013-04-21 10:45:11
@JermaineXu默认的perm空间是128MB,但它在一个月后达到了 – Fatkun 2013-04-21 10:48:14