https://stackoverflow.com/questions/16130292/java-lang-outofmemoryerror-permgen-space-java-reflection

When using Java reflection, the JVM has two methods of accessing the information on the class being reflected. It can use a JNI accessor, or a Java bytecode accessor. If it uses a Java bytecode accessor, then it needs to have its own Java class and classloader (sun/reflect/GeneratedMethodAccessor class and sun/reflect/DelegatingClassLoader). Theses classes and classloaders use native memory. The accessor bytecode can also get JIT compiled, which will increase the native memory use even more. If Java reflection is used frequently, this can add up to a significant amount of native memory use. The JVM will use the JNI accessor first, then after some number of accesses on the same class, will change to use the Java bytecode accessor. This is called inflation, when the JVM changes from the JNI accessor to the bytecode accessor. Fortunately, we can control this with a Java property. The sun.reflect.inflationThreshold property tells the JVM what number of times to use the JNI accessor. If it is set to 0, then the JNI accessors are always used. Since the bytecode accessors use more native memory than the JNI ones, if we are seeing a lot of Java reflection, we will want to use the JNI accessors. To do this, we just need to set the inflationThreshold property to zero.

原文地址:https://www.cnblogs.com/diyunpeng/p/8159677.html

时间: 2024-11-14 13:09:56

https://stackoverflow.com/questions/16130292/java-lang-outofmemoryerror-permgen-space-java-reflection的相关文章

Exception in thread "Thread-12751" java.lang.OutOfMemoryError: PermGen space

转载自 :http://greemranqq.iteye.com/blog/1705867转载自:http://www.cnblogs.com/xwdreamer/archive/2011/11/21/2296930.html Java代码   Exception in thread "ContainerBackgroundProcessor[StandardEngine[Catalina]]" Java代码   java.lang.OutOfMemoryError: PermGen 

HTTP Status 500 - javax.servlet.ServletException: java.lang.OutOfMemoryError: PermGen space

详细错误信息 HTTP Status 500 - javax.servlet.ServletException: java.lang.OutOfMemoryError: PermGen space type Exception report message javax.servlet.ServletException: java.lang.OutOfMemoryError: PermGen space description The server encountered an internal

jvm 内存溢出 在myeclipse中加大tomcat的jvm内存 java.lang.OutOfMemoryError: PermGen space

使用myeclipse启动部署在tomcat7下的三个项目报出java.lang.OutOfMemoryError: PermGen space 解决办法: 在myeclipse中加大jvm内存方法:Window->Preferences->Myeclipse->Services->Tomcat->Tomcat 6.x->JDK,在Optional Java VM arguments:下边的输入框里输入:-Xms128m -Xmx512m -XX:PermSize=12

Eclipse:java.lang.OutOfMemoryError: PermGen space

先是好端端的上不了网,然后电脑就重启,重启之后,整个项目就报"java.lang.OutOfMemoryError: PermGen space" 网上说了很多方法,什么修改eclipse.ini,修改tomcat bin目录下的catalina.sh文件,但是对我问题没有一点用处, 最后,解决方案如下: 记住一定要换行啊!

异常处理系列:java.lang.OutOfMemoryError: PermGen space

今天帮同学解决他的Tomcat启动的问题,报出了一个OutOfMemoryError的异常,然后就搜啊搜的,突然发现特别有趣. 先不扯淡了,先说解决办法: 一看到这个就知道是内存满了.所以要把Tomcat的内存池加大一点. 修改如下: 1. window-->Preferences,然后直接在搜索的那个框里边写上"tomcat",会出现如下的界面: 2. 选中你安装的tomcat版本,选中下面的JDK,在右边的 Optional Java VM arguments 文本框中输入:

tomcat 开启时,或者访问网页后PermGen space错误解决方法 java.lang.OutOfMemoryError: PermGen space

公司以前都是一个项目一个tomcat,为了整合,我把两个项目放到了一个tomcat下,结果打开tomcat后,随便访问几个网页,或者登录一个账号后就会报错,提示 java.lang.OutOfMemoryError: PermGen space 上网搜索后,发现是JVM的默认内存只有4M太小,开启tomcat后要加载所有项目,就会导致JVM的内存溢出. Windows下tomcat修改 .编辑tomcat的catalina.bat文件,在第一行的后面增加一句:set JAVA_OPTS=-ser

Tomcat – Java.Lang.OutOfMemoryError: PermGen Space

很多时候,在开发阶段Tomcat重复的重启过程中会遇到java.lang.OutOfMemoryError : PermGen space 错误. 1 2 3 4 java.lang.OutOfMemoryError: PermGen space         at java.lang.ClassLoader.defineClass1(Native Method)         at java.lang.ClassLoader.defineClass(ClassLoader.java:620

java.lang.OutOfMemoryError: PermGen space PermGen space & java.lang.OutOfMemoryError: Java heap space Heap siz

java.lang.OutOfMemoryError: PermGen space PermGen space 由-XX:PermSize  -XX:MaxPermSize 引起 java.lang.OutOfMemoryError: Java heap space Heap siz 由-Xms -Xmx 引起 Liunx下修改:catalina.sh # OS specific support.  $var _must_ be set to either true or false. JAVA

Tomcat – java.lang.OutOfMemoryError: PermGen space Cause and Solution

Read more: http://javarevisited.blogspot.com/2012/01/tomcat-javalangoutofmemoryerror-permgen.html#ixzz3QDWa3Zqi Tomcat web server often suffers from java.lang.OutOfMemoryError: PermGen space whenever you deploy and undeploy your web application coupl

java.lang.OutOfMemoryError: PermGen space及其解决方法

PermGen space的全称是Permanent Generation space,是指内存的永久保存区域OutOfMemoryError: PermGen space从表面上看就是内存益出,解决方法也一定是加大内存.说说为什么会内存益出:这一部分用于存放Class和Meta的信息,Class在被 Load的时候被放入PermGen space区域,它和和存放Instance的Heap区域不同,GC(Garbage Collection)不会在主程序运行期对PermGen space进行清理