内存溢出

java.lang.OutOfMemoryError: Java heap space

原因:Heap内存溢出,意味着Young和Old generation的内存不够。

解决:调整java启动参数-Xms -Xmx 来增加Heap内存。

java.lang.OutOfMemoryError: unable to create new native thread

原因:Stack空间不足以创建额外的线程,要么是创建的线程过多,要么是Stack空间确实小了。

解决:由于JVM没有提供参数设置总的stack空间大小,但可以设置单个线程栈的大小;而系统的用户空间一共是3G,除了Text/Data/BSS /MemoryMapping几个段之外,Heap和Stack空间的总量有限,是此消彼长的。因此遇到这个错误,可以通过两个途径解决:1.通过 -Xss启动参数减少单个线程栈大小,这样便能开更多线程(当然不能太小,太小会出现StackOverflowError);2.通过-Xms -Xmx 两参数减少Heap大小,将内存让给Stack(前提是保证Heap空间够用)。

java.lang.OutOfMemoryError: PermGen space

原因:Permanent Generation空间不足,不能加载额外的类。

解决:调整-XX:PermSize= -XX:MaxPermSize= 两个参数来增大PermGen内存。一般情况下,这两个参数不要手动设置,只要设置-Xmx足够大即可,JVM会自行选择合适的PermGen大小。

java.lang.OutOfMemoryError: Requested array size exceeds VM limit

原因:这个错误比较少见(试着new一个长度1亿的数组看看),同样是由于Heap空间不足。如果需要new一个如此之大的数组,程序逻辑多半是不合理的。

解决:修改程序逻辑吧。或者也可以通过-Xmx来增大堆内存。

在GC花费了大量时间,却仅回收了少量内存时,也会报出OutOfMemoryError ,我只遇到过一两次。当使用-XX:+UseParallelGC或-XX:+UseConcMarkSweepGC收集器时,在上述情况下会报错,在 HotSpot GC Turning文档 上有说明:

The parallel(concurrent) collector will throw an OutOfMemoryError if too much time is being spent in garbage collection: if more than 98% of the total time is spent in garbage collection and less than 2% of the heap is recovered, an OutOfMemoryError will be thrown.

对这个问题,一是需要进行GC turning,二是需要优化程序逻辑。

java.lang.StackOverflowError

原因:这也内存溢出错误的一种,即线程栈的溢出,要么是方法调用层次过多(比如存在无限递归调用),要么是线程栈太小。

解决:优化程序设计,减少方法调用层次;调整-Xss参数增加线程栈大小。

IOException: Too many open files

原因: 这个是由于TCP connections 的buffer 大小不够用了。

java.lang.OutOfMemoryError:Direct buffer memory

解决:调整-XX:MaxDirectMemorySize=

转载于:https://www.cnblogs.com/zt528/p/3245330.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/418592.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

前端学习(1902)vue之电商管理系统电商系统之渲实现添加用户前的预先校验

目录结构 router.js import Vue from vue import Router from vue-router import Login from ./components/Login.vue import Home from ./components/Home.vue import Welcome from ./components/Welcome.vue Vue.use(Router)const router new Router({routes: [{path: /,re…

git生成公钥和私钥

转自:http://blog.csdn.net/wqjsir/article/details/17386087/ 一、 Git windows 客服端(MsysGit)下载 下载地址:http://code.google.com/p/msysgit/ 二、从开始菜单中找到Git 点击Git Bash 弹出命令行窗体,如下图&…

后台导出大量数据超时报 nginx404错误

https://blog.csdn.net/weixin_30695195/article/details/95163683

前端学习(1903)vue之电商管理系统电商系统之调用api添加用户

目录结构 router.js import Vue from vue import Router from vue-router import Login from ./components/Login.vue import Home from ./components/Home.vue import Welcome from ./components/Welcome.vue Vue.use(Router)const router new Router({routes: [{path: /,re…

每日站立会议08

会议图片: 会议内容:祖浩然:昨天:对数据库的操作有了大概的了解;今天:制作增加、修改、删除、查询学生信息功能,以及退出主界面;遇到的问题:如何将网页地址以超链接形式…

java 8排序

https://www.cnblogs.com/invoker-/p/7709411.html

前端学习(1904)vue之电商管理系统电商系统之修改用户的操作

目录结构 router.js import Vue from vue import Router from vue-router import Login from ./components/Login.vue import Home from ./components/Home.vue import Welcome from ./components/Welcome.vue Vue.use(Router)const router new Router({routes: [{path: /,re…

前端学习(1905)vue之电商管理系统电商系统之根据用户id查询对应的信息

目录结构 router.js import Vue from vue import Router from vue-router import Login from ./components/Login.vue import Home from ./components/Home.vue import Welcome from ./components/Welcome.vue Vue.use(Router)const router new Router({routes: [{path: /,re…

SQL的主键和外键约束 小记

http://www.cnblogs.com/ywb-lv/archive/2012/03/12/2391860.html转载于:https://www.cnblogs.com/chengjun/p/5443002.html

简单快速的用SpringBoot访问静态资源(图片、html)

https://blog.csdn.net/qq_36481052/article/details/79075214

前端学习(1906)vue之电商管理系统电商系统之渲染修改用户的表单

目录结构 router.js import Vue from vue import Router from vue-router import Login from ./components/Login.vue import Home from ./components/Home.vue import Welcome from ./components/Welcome.vue Vue.use(Router)const router new Router({routes: [{path: /,re…

linux6.4 安装oracle11g 出现错误ORA-01078和LRM-00109错误

在linux中oracle11g安装成功后,启动监听(lsnrctl start)后,运行sqlplus / as sysdba后连接 startup出现了如下图的错误ORA-01078和LRM-00109错误 解决方法: 我当时也上网百度了一下,基本也都大同小异&…

前端学习(1907)vue之电商管理系统电商系统之渲染修改用户的表单的重置操作

目录结构 router.js import Vue from vue import Router from vue-router import Login from ./components/Login.vue import Home from ./components/Home.vue import Welcome from ./components/Welcome.vue Vue.use(Router)const router new Router({routes: [{path: /,re…

Java读取resource文件/路径的几种方式

https://blog.csdn.net/oschina_40188932/article/details/78833754

HDU 5617 Jam's maze dp+滚动数组

题目链接: hdu: http://acm.hdu.edu.cn/showproblem.php?pid5617 bc(中文): http://bestcoder.hdu.edu.cn/contests/contest_chineseproblem.php?cid666&pid1003 题解: 设dp[x1][x2][i]表示第i步时,从(1,1)点走到了(x1,y1)&…

前端学习(1908)vue之电商管理系统电商系统之渲染修改用户的表单预先验证

目录结构 router.js import Vue from vue import Router from vue-router import Login from ./components/Login.vue import Home from ./components/Home.vue import Welcome from ./components/Welcome.vue Vue.use(Router)const router new Router({routes: [{path: /,re…

MySQL根据某一个或者多个字段查找重复数据

https://blog.csdn.net/qq_35834998/article/details/84847243

HOJ 2678 Stars

题意:N个星星(x,y,z),星星的等级等于x,y,z都小于等于它的星星数量,问每个等级有多少星星。 思路:最暴力的方法是三维树状数组。但是会超内存。所以我们对其中一维先排好序,然后用二维的做。 代码…

前端学习(1909)vue之电商管理系统电商系统之渲染修改用户的请求

目录结构 router.js import Vue from vue import Router from vue-router import Login from ./components/Login.vue import Home from ./components/Home.vue import Welcome from ./components/Welcome.vue Vue.use(Router)const router new Router({routes: [{path: /,re…

Spring使用注解@Transactional事物手动回滚

https://blog.csdn.net/weixin_41141219/article/details/80751258