java.lang.OutOfMemoryError: PermGen space still exist

java.lang.OutOfMemoryError: PermGen space still exist

我在eclipse中通过tomcat调试一个项目,抛出如下错误: 而且日食不是没有反应,错误报告如

Daemon System Thread [Java2D Disposer] (Suspended (exception OutOfMemoryError)) owns: Win32GraphicsEnvironment (id=116) owns: FontStrikeDisposer (id=117) D3DGraphicsDevice.getDeviceCaps(int) line: 108 D3DGraphicsDevice.createDevice(int) line: 87
Win32GraphicsEnvironment.makeScreenDevice(int) line: 208
Win32GraphicsEnvironment(SunGraphicsEnvironment).getScreenDevices() line: 139 Win32GraphicsEnvironment.getDefaultScreenDevice() line: 96 StrikeCache.disposeStrike(FontStrikeDisposer) line: 284 FontStrikeDisposer.dispose() line: 98

再次调试时,报错如

严重: Servlet.service() for servlet [springDispatcher] in context with path [/api] threw exception [Handler processing failed; nested exception is java.lang.OutOfMemoryError: PermGen space] with root cause java.lang.OutOfMemoryError: PermGen space at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2957) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1210) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1690) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2957) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1210) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1690) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571) at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.getConnection(JedisConnectionFactory.java:144) at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.getConnection(JedisConnectionFactory.java:41) at org.springframework.data.redis.core.RedisConnectionUtils.doGetConnection(RedisConnectionUtils.java:85) at org.springframework.data.redis.core.RedisConnectionUtils.getConnection(RedisConnectionUtils.java:55) at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:169) at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:149) at org.springframework.data.redis.core.AbstractOperations.execute(AbstractOperations.java:84) at org.springframework.data.redis.core.DefaultHashOperations.get(DefaultHashOperations.java:44) at com.unistrong.tracker.service.cache.UserCache.getUserToken(UserCache.java:31) at com.unistrong.tracker.handle.UserHandle.saveLogon(UserHandle.java:439) at com.unistrong.tracker.web.UserController.logon(UserController.java:98) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)

Exception in thread "Java2D Disposer"

我已经更改eclipse.ini和tomcat以扩大内存,但错误仍然存​​在

如何解决问题?提前谢谢你!

您需要通过 java 命令参数增加 PermGen 大小:

-XX:MaxPermSize=128M