零. 简单介绍
OutOfMemory 意思就是须要申请更大的内存, 可是内存限制无法申请到须要的内存。



一. 解决方法
基本上解决方向有两种:

  1. 检查程序是否有问题。 是不是写死循环不停地创建并持有对象导致内存不足

  1. 内存确实不够, 分为老年代内存不足和永久代内存不足

(1) 老年代内存不足

看一段 GC 日志:在 Full GC 结束后, 可是老年代占用空间还是接近或者等于老年代最大空间, 说明老年代空间确实分配不够。 调大 -Xms、 -Xmx 并保持新生代大小不变。直到 GC 日志不出现keyword Exception in thread  “main” java.lang.OutOfMemoryError: Java heap space。

2016-01-19T14:18:19.883+0800: 179.163: [CMS-concurrent-reset-start]
2016-01-19T14:18:19.893+0800: 179.173: [CMS-concurrent-reset: 0.009/0.009 secs] [Times: user=0.02 sys=0.00, real=0.01 secs]
{Heap before GC invocations=154 (full 1):
par new generation total 943744K, used 850746K [0x0000000757000000, 0x0000000797000000, 0x0000000797000000)
eden space 838912K, 100% used [0x0000000757000000, 0x000000078a340000, 0x000000078a340000)
from space 104832K, 11% used [0x000000078a340000, 0x000000078aecea30, 0x00000007909a0000)
to space 104832K, 0% used [0x00000007909a0000, 0x00000007909a0000, 0x0000000797000000)
concurrent mark-sweep generation total 1560576K, used 1560576K [0x0000000797000000, 0x00000007f6400000, 0x00000007f6400000)
concurrent-mark-sweep perm gen total 159744K, used 69030K [0x00000007f6400000, 0x0000000800000000, 0x0000000800000000)

(2) 永久代内存不足
看一段 GC 日志:在 Full GC 结束后, 可是永久代占用空间还是接近或者等于永久代最大空间, 说明永久代空间确实分配不够。

调大 -XX:PermSize、 -XX:MaxPermSize,直到 GC 日志不出现keyword Exception in thread  “main” java.lang.OutOfMemoryError: PermGen space。

2016-01-19T14:18:19.883+0800: 179.163: [CMS-concurrent-reset-start]
2016-01-19T14:18:19.893+0800: 179.173: [CMS-concurrent-reset: 0.009/0.009 secs] [Times: user=0.02 sys=0.00, real=0.01 secs]
{Heap before GC invocations=154 (full 1):
par new generation total 943744K, used 850746K [0x0000000757000000, 0x0000000797000000, 0x0000000797000000)
eden space 838912K, 100% used [0x0000000757000000, 0x000000078a340000, 0x000000078a340000)
from space 104832K, 11% used [0x000000078a340000, 0x000000078aecea30, 0x00000007909a0000)
to space 104832K, 0% used [0x00000007909a0000, 0x00000007909a0000, 0x0000000797000000)
concurrent mark-sweep generation total 1560576K, used 345246K [0x0000000797000000, 0x00000007f6400000, 0x00000007f6400000)
concurrent-mark-sweep perm gen total 159744K, used 159744K [0x00000007f6400000, 0x0000000800000000, 0x0000000800000000)

最新文章

  1. PageRank理论与实践及用户评分应用PeopleRank算法
  2. myeclipse激活时cracker2015.jar打不开
  3. Node.js网络编程
  4. (七)play之yabe项目【CRUD】
  5. 最新版postgresql+pgboucer安装
  6. Android本地JUnit Text
  7. (原创)Maven+Spring+CXF+Tomcat7 简单例子实现webservice
  8. Oracle绝对秒数转换为时间戳
  9. Ionic3在ts中获取html中值的方法
  10. BBU和RRU具体区别是 什么?
  11. C++ virtual函数重写,在继承的时候没有在函数前写virtual关键字也依然是虚函数吗?
  12. How to Pronounce the Numbers 1 – 10
  13. “Linux内核分析”实验三报告
  14. linux获取日志指定行数范围内的内容
  15. centOS7.2下 搭建gitlab使用git为团队管理代码
  16. Button 或 ImageButton 背景设为 透明 或半透明 (转)
  17. 【每天一条Linux指令-Day1】kill掉多个mysql的进程
  18. [LintCode] 用栈实现队列
  19. ubuntu 中wget (下载)命令用法
  20. solr-用mmseg4j配置同义词索引和检索(IKanlyzer需要修改源码适应solr接口才能使用同义词功能)

热门文章

  1. C# json 总结
  2. BZOJ2142: 礼物(拓展lucas)
  3. POJ Oulipo(KMP模板题)
  4. Bootstrap时间控件常用配置项
  5. 15、python学习手册之:元组、文件及其他
  6. 在CentOS7 开发与部署 asp.net core app笔记
  7. iOS开发之CocoaPods(objective-c第三方库管理工具)
  8. 硬件——nrf51822第三篇,按键控制小灯
  9. 【例题 6-14 UVA-816】Abbott's Revenge
  10. 【z05】聪明的质检员