java.lang.OutOfMemoryError: PermGen space
PermGen space,全称是Permanent Generation space,
就是说是永久保存的区域,用于存放Class和Meta信息,Class在被Load的时候被放入该区域
从字面看,和存放Instance的Heap区域不同,
GC(Garbage Collection)应该不会对PermGen space进行清理
所以如果你的APP会LOAD很多CLASS的话,就很可能出现PermGen space错误
解决方法: to increase the value specified with -XX:MaxPermSize.
OutOfMemoryError looks a bit better! OutOfMemoryError has always been a confusing error. For a long time the HotSpot Virtual Machine threw this error without a detail message or stack trace so typically the thread throwing the error would terminate with this:
Exception in thread "main" java.lang.OutOfMemoryError
That was confusing. Is my java heap full or does it mean something else? Those familiar with the heap layout that the HotSpot VM uses will know that the "something else" might mean the "permanent generation". This is place where reflective data such as class and method objects are allocated. It is also the place where interned strings are stored. If you've got an application that loads a huge number of classes or interns millions of strings then it's possible that the OutOfMemoryError is because the permanent generation is full rather than the java heap.
In 5.0 the error is less confusing as there is a detail message. This means you will see something like this:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
or:
Exception in thread "main" java.lang.OutOfMemoryError: PermGen full
In Mustang, there has been further changes to the way that OutOfMemoryError is reported. One obvious one is that the HotSpot VM will attempt to include a stack trace. This means you should see something like this:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at ConsumeHeap$BigObject.(ConsumeHeap.java:22) at ConsumeHeap.main(ConsumeHeap.java:47)
In this example we see the stack trace where the allocation failed. If the OutOfMemoryError is because the perm gen it full then you might see String.intern or ClassLoader.defineClass near the top of the stack.
Is a stack trace useful? In some limited cases it can be. For example, suppose you've got a thread looping and in the loop it is allocating objects and putting them into a collection. In that case the stack trace might direct you to a good starting place. More generally, the stack trace is not likely to be useful. If you've got a busy application and the heap is nearly full, then OutOfMemoryError will be likely be thrown in some random place by some random mutator.
One useful improvement is the -XX:+HeapDumpOnOutOfMemoryError option which tells the HotSpot VM to generate a heap dump when an allocation from the java heap or the permanent generation cannot be satisfied. There isn't any overhead to running with this option so it should be useful for production systems where OutOfMemoryError takes weeks (or longer) to surface. The heap dump is in HPROF binary format so it can be analyzed using any tools that can import this format. If you read Sundar's blog then you'll know that Mustang includes a useful tool called jhat which can be used to do rudimentary analysis of the dump. jhat supports Object Query Language so you can easily create your own queries and mine the heap dump.
The next improvement is visible when the system is almost out of swap space and an allocation from the native heap fails in the VM. In that case the VM aborts and you get a one-line error such as the following:
Exception java.lang.OutOfMemoryError: requested 16 bytes for CHeapObj-new. Out of swap space?
This message has been known to confuse a lot of developers. At first glance it might it might look like that the java heap is full. Of course if you increase the size of the heap with the -mx option it might make the problem worse as the larger java heap means there is less native memory available.
In Mustang this condition will trigger the VM to invoke the fatal error handling mechanism. This means you should get a fatal error log as you would get with a normal (abnormal?) crash. The fatal error log is named hs_err_<pid>.log and contains useful information about the thread, process, and system at the time of the crash. In the case of native heap exhaustion then the heap memory and memory map information in the log can be useful. The exact format is version and platform specific and you will get more information in the J2SE Troubleshooting Guide.
Hopefully, developers will find these improvements useful. It should make OutOfMemoryError a little less confusing and it means the error is no longer a one-line wonder.
Heap java.lang.OutOfMemoryError:Java heap space
Method area java.lang.OutOfMemoryError:PermGen full
Java stack StackOverFlow
Native method stack JVM无法控制的内存溢出问题native heap OutOfMemory
分享到:
相关推荐
解决Out of memory问题,玩游戏的童鞋遇到的问题,希望能帮到那些遇到此类问题的童鞋
Out of memory-cannot load design mode
tomcat out of memory,近来web经常out of memory down机,查找的一些资料
java OutOfMemory的一个解决方法
Out of memory,insufficient memory to continue.
最近在跑程序,然后Pycharm就跳出out of memory 的错误提示,可能是由于读取的数据太多导致的,Pycharm有一个默认内存的最大容量上线,跳出提示的是1024M,也就是分配给Pycharm的内内存不够啦! 一、说明: pycharm...
一次奇怪的Out of Memory 分析(附图)
NULL 博文链接:https://keren021.iteye.com/blog/1163165
tomcat out of memory solution
android bitmap outofMemory 用来解决android中常见的bitmap outOfMemory
NULL 博文链接:https://boyseegirl.iteye.com/blog/1729527
Out of memory (Needed 16777224 bytes)的错误解决 看看手册: [url]http://dev.mysql.com/doc/refman/5.1/en/memory-storage-engine.html[/url] 开始我更改了query_cache_size的值。 好像也不行。 之后 增大query_...
今天发现网站有点慢,发现mysql日志中提示mysqld-nt: Out of memory (Needed 1677720 bytes),经排查是由于最近调整了mysql的一些参数导致,以为内存大就不怕了,32位系统真心内容利用率很低,据说不超过4G,我们的...
最近公司将内部使用的代码由svn迁到了git上,所以也必须学者使用Git命令。 虽说git的模式和svn区别很大,但想必也不是什么难事。...fatal: Out of memory, malloc failed (tried to allocate 1941159936 b
今天小编就为大家分享一篇解决Python运行文件出现out of memory框的问题,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
out of memory是什么意思.docx
Android完美解决GridView异步加载图片和加载大量图片时出现Out Of Memory问题
解决CUDA error_out of memory的问题