• Exception in thread "http-bio-8081-exec-3" java.lang.OutOfMemoryError: PermGen space


    前言:

    http://www.cnblogs.com/wql025/p/4865673.html一文中我曾描述这种异常也提供了解决方式,但效果不太理想,现在用本文的方式,效果显著。

    目前此项目只能登录,再打开其他功能模块即出现以下异常:

    Exception in thread "http-bio-8081-exec-3" 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 java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at org.eclipse.jdt.internal.compiler.classfmt.MethodInfo.decodeLocalVariableAttribute(MethodInfo.java:529)
    at org.eclipse.jdt.internal.compiler.classfmt.MethodInfo.decodeCodeAttribute(MethodInfo.java:511)
    at org.eclipse.jdt.internal.compiler.classfmt.MethodInfo.readCodeAttribute(MethodInfo.java:482)
    at org.eclipse.jdt.internal.compiler.classfmt.MethodInfo.getArgumentNames(MethodInfo.java:251)
    at org.eclipse.jdt.internal.compiler.classfmt.MethodInfo.initialize(MethodInfo.java:349)
    at org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.initialize(ClassFileReader.java:1153)
    at org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.<init>(ClassFileReader.java:388)
    at org.apache.jasper.compiler.JDTCompiler$1.findType(JDTCompiler.java:231)
    at org.apache.jasper.compiler.JDTCompiler$1.findType(JDTCompiler.java:203)
    at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:157)
    at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(PackageBinding.java:201)
    at org.eclipse.jdt.internal.compiler.lookup.Scope.getPackage(Scope.java:2982)
    at org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:97)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.internalResolveType(TypeReference.java:472)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:571)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:567)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveSuperType(TypeReference.java:541)
    at org.eclipse.jdt.internal.compiler.lookup.ClassScope.findSupertype(ClassScope.java:1287)
    at org.eclipse.jdt.internal.compiler.lookup.ClassScope.connectSuperclass(ClassScope.java:938)
    at org.eclipse.jdt.internal.compiler.lookup.ClassScope.connectTypeHierarchy(ClassScope.java:1095)
    at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.connectTypeHierarchy(CompilationUnitScope.java:323)

    从名字可以看出此异常是内存溢出。之前遇到好多次,解决的方案多是增加Tomcat内存,但效果几乎都不理想,今天没有动Tomcat,只是增加了eclipse的内存,此方案出自http://bbs.csdn.net/topics/390961799magi1201网友的留言。

    下面是我的解决步骤:

    1、先在eclipse安装目录中将eclipse的启动参数调大一些--在eclipse的安装目录的ini文件,我用的是STS,所以是STS.ini文件

    原文件参数:

    -startup
    plugins/org.eclipse.equinox.launcher_1.3.100.v20150511-1540.jar
    --launcher.library
    plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.300.v20150602-1417
    -product
    org.springsource.sts.ide
    --launcher.defaultAction
    openFile
    --launcher.XXMaxPermSize
    256M
    -vmargs
    -Dosgi.requiredJavaVersion=1.7
    -Xms40m
    -XX:MaxPermSize=256m
    -Xverify:none
    -Dorg.eclipse.swt.browser.IEVersion=10001
    -Xmx1200m

    调整后的文件参数:

    -startup
    plugins/org.eclipse.equinox.launcher_1.3.100.v20150511-1540.jar
    --launcher.library
    plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.300.v20150602-1417
    -product
    org.springsource.sts.ide
    --launcher.defaultAction
    openFile
    --launcher.XXMaxPermSize
    512M
    -vmargs
    -Dosgi.requiredJavaVersion=1.7
    -Xms40m
    -XX:MaxPermSize=512m
    -Xverify:none
    -Dorg.eclipse.swt.browser.IEVersion=10001
    -Xmx1200m

    注:红色字体为修改参数

    2、然后在eclipse的server栏,找到tomcat选项,打开tomcat的配置

    2.1

    2.2

    2.3

    在arguments 标签框下面的VM Arguments 框后面接上自己的tomcat启动虚拟机参数就可以了。注:红色线标注的为新增内容。记得点Apply和OK哦

    后记:此方法一试就灵,原来本项目的内存只够登录,再点击别的功能均出现此异常,安装上面的方法进行修改后立即恢复正常。但是最重要的考验是在运行情况下修改项目--待考验...

  • 相关阅读:
    洛谷 P1903 【模板】分块/带修改莫队(数颜色)
    BZOJ 2038: [2009国家集训队]小Z的袜子(hose)
    LibreOJ #6208. 树上询问
    LibreOJ #6002. 「网络流 24 题」最小路径覆盖
    hdu 3861 The King’s Problem
    洛谷 P2868 [USACO07DEC]观光奶牛Sightseeing Cows
    洛谷 P2905 [USACO08OPEN]农场危机Crisis on the Farm
    洛谷 U3348 A2-回文数
    洛谷 P1001 A+B Problem
    LibreOJ #2130. 「NOI2015」软件包管理器
  • 原文地址:https://www.cnblogs.com/wql025/p/5160567.html
Copyright © 2020-2023  润新知