- 浏览: 1533039 次
- 性别:
- 来自: 厦门
-
文章分类
- 全部博客 (516)
- Java (49)
- Java/Struts 2.0 (25)
- Java/Spring、Spring MVC (11)
- Java/Quartz (3)
- Java/Lucene (6)
- Java/Hibernate (19)
- Java/openJPA (7)
- Java/DWR (7)
- Java/Security、Spring Security/OAuth2 (6)
- Java/Threading (9)
- Java/XML (22)
- java/design pattern (4)
- Android (2)
- JavaScript (46)
- jquery (3)
- DB/MySQL (23)
- DB/Oracle (16)
- PHP (25)
- CSS (20)
- Linux (38)
- C/C++、DLL、Makefile、VC++ (31)
- 正则 (9)
- Eclipse (4)
- 安全、网络等概念 (25)
- 集群 (7)
- 网页 (5)
- 视频\音频 (1)
- HTML (6)
- 计算机数学/算法 (3)
- Virtualbox (1)
- LDAP (2)
- 数据挖掘 (6)
- 工具破解 (1)
- 其他 (13)
- Mail (1)
- 药材 (3)
- 游戏 (2)
- hadoop (13)
- 压力测试 (3)
- 设计模式 (3)
- java/Swing (2)
- 缓存/Memcache (0)
- 缓存/Redis (1)
- OSGI (2)
- OSGI/Gemini (0)
- 文档写作 (0)
- java/Servlet (3)
- MQ/RabbitMQ (2)
- MQ/RocketMQ (0)
- MQ/Kafka (1)
- maven (0)
- SYS/linux (1)
- cache/redis (1)
- DB/Mongodb (2)
- nginx (1)
- postman (1)
- 操作系统/ubuntu (1)
- golang (1)
- dubbo (1)
- 技术管理岗位 (0)
- mybatis-plus (0)
最新评论
-
pgx89112:
大神,请赐我一份这个示例的项目代码吧,万分感谢,1530259 ...
spring的rabbitmq配置 -
string2020:
不使用增强器 怎么弄?
OpenJPA的增强器 -
孟江波:
学习了,楼主,能否提供一份源代码啊,学习一下,十分感谢!!!4 ...
spring的rabbitmq配置 -
eachgray:
...
spring-data-redis配置事务 -
qljoeli:
学习了,楼主,能否提供一份源代码啊,学习一下,十分感谢!!!1 ...
spring的rabbitmq配置
http://blogs.opcodesolutions.com/roller/java/entry/solve_java_lang_outofmemoryerror_java
An OOM or OOME (OutOfMemoryError) simply means that the JVM ran out of memory. When this occurs, you basically have 2 choices:
- Allow the JVM to use more memory using the -Xmx VM argument. For instance, to allow the JVM to use 1 GB (1024 MB) of memory:
java -Xmx1024m ...
- Improve/Fix the application so that it uses less memory
In many cases, like in the case of a memory leak, the second option is the only sound choice. A memory leak happens when the application keeps more and more references to objects and never releases them. The garbage collector will therefore never collect those objects and less and less free memory will be available until we reach the point where not enough free memory is available for the application to function normally. At this point, the JVM will throw an OOM.
A memory leak can be very latent. For instance, the application might behave flawlessly during development and QA. However, it suddenly throws a OOM after several days in production at customer site. To solve that issue, you first need to find the root cause of it. The root cause can be very hard to find in development if it cannot be reproduced in-house. Here are the steps to follow in order to find the root cause and fix that issue:
- Start the application with the VM argument -XX:+HeapDumpOnOutOfMemoryError . This will tell the VM to produce a heap dump when a OOM occurs:
java -XX:+HeapDumpOnOutOfMemoryError ...
- Reproduce the problem. Well, if you cannot reproduce in dev, you will have to use the production environment.
- Use VisualVM to read the heap dump file and diagnose the issue.
First of all, a heap dump is the dump of the heap (duh!). It will allow you to navigate the heap and see what objects use all the heap memory and which are the ones that still keep a reference on them, and so on and so forth. This will give you very strong hints and you will (hopefully) be able to find the root cause of the problem. The problem could be a cache that grows indefinitely, a list that keeps collecting business-specific data in memory, a huge request that tries to load almost all data from database in memory, etc.
Once you know the root cause of the problem, you can elaborate solutions to fix it. In case of a cache that grows indefinitely, a good solution could be to set a reasonable limit to that cache. In case of a query that tries to load almost all data from database in memory, you may have to change the way you manipulate data; you could even have to change the behavior of some functionalities of the application.
If you do not want to wait for a OOM or if you just want to see what is in memory, you can still generate heap dump. To manually trigger a heap dump, you have 2 choices:
- Use VisualVM , right-click on the process on the left pane and select Heap Dump
- If you do not have a graphical environment and can't use vnc (VisualVM needs a graphical environment), use jps and jmap to generate the heap dump file. Then copy the file to your workstation and use VisualVM to read the heap dump (File -> Load...):
user@host:~$ jps
20198
21734 WordFinder
21921 Jps
21168 Main
user@host:~$ jmap -dump:live,format=b,file=heap.bin 21734
Dumping heap to /home/user/heap.bin ...
Heap dump file created
Here is what VisualVM looks with a heap dump:
Alternatively, you can also use jhat to read heap dumps.
发表评论
-
HttpRequestClient
2018-11-21 17:45 636http请求工具 public class WebCon ... -
Spring boot 环境下配置CKEditor添加google map
2017-07-05 14:39 1269本文档基于已经搭建好基础ckeditor的环境上。如:ht ... -
post json
2015-12-30 12:35 552方法一: public static String doP ... -
maven打包成可执行的jar包(package a runnable jar)
2015-04-23 22:01 2228第一步:利用maven-jar-plugin生成当前工程的 ... -
自定义ObjectMapper
2015-03-02 16:57 7786d import java.io.IOExcept ... -
JsonObjectMapper
2015-02-05 10:41 1407import com.fasterxml.jackson. ... -
HttpServletRequestWrapper
2014-10-12 08:15 599请求提交后替换HTML字符 import javax.s ... -
配置javamelody
2014-09-12 14:03 1282参考后面地址修改整理。http://my.oschina.n ... -
getTrace()
2014-08-06 09:14 573/** * 将e.printStackTrace() ... -
获取java对象在内存的地址
2014-07-28 14:59 2871引用stackflow的文章:http://stackove ... -
JMeter入门:Java Request实例
2014-05-08 15:41 2367转自:http://softtest.chin ... -
解决在IE下下载时文件名乱码
2014-01-09 11:24 1063String agent = request.getHead ... -
第一节:编译自定义的Hadoop核心包,去除用户权限检查
2013-11-30 11:59 1076本文参考eclipse连接远程hadoop集群开发时0700 ... -
第二节:win 7下编译eclispe hadoop plugin
2013-11-29 19:12 842本文参照后面地址的Linux编译方式:http: ... -
使用log4j为Tomcat输出日志
2013-11-01 16:42 10354转自:http://hi.baidu.com/y ... -
xStream开发HTTP的XML内容
2013-07-03 09:58 10641、编写自定义XPPDriver代码: package ... -
HttpURLConnection or URLConnection post xml content to web server
2013-05-31 01:56 2070客户端示例1: package client; ... -
java nio学习笔记
2013-03-21 21:41 0直接缓冲区被用于与通道和固有I/O例程交互。它们 ... -
Jsch使用
2012-12-10 17:07 2564Jsch shell模式下的代码示例: 参考: ... -
Exe4j破解_Exe4j注册码
2012-12-06 17:35 33557exe4j是个很好的打包利器,官方下载地址:http://ww ...
相关推荐
gcr.io/distroless/static:latest,制作k8s.gcr.io/metrics-server/metrics-server:v0.4.1的基础资源
- difficult(adj.):困难的,例如:This math problem is really difficult to solve. U6T1: - field(n.):田野,例如:The children are playing in the field. - proper(adj.):恰当的,例如:You should ...
16. 按照,根据...:according to 17. 参加(游戏/活动)等:take part in 18. 如此...以至于...:so...that... 19. 面对面:face to face 20. 故意:on purpose **Unit 2 English Around The World** 1. 起着重要...
1. **SOLVE**: 开始求解过程,ANSYS会自动进行预处理、求解和后处理。 2. **POST1**: 后处理命令,可以查看结果数据,绘制图形。 3. **DISPLACEMENT**: 查看或显示位移结果。 4. **STRESS**: 显示或分析应力结果,...
冲击动力学仿真软件:IMPETUS Afea Solver.docx 冲击动力学仿真软件:IMPETUS Afea Solverv1.docx 冲击动力学仿真软件:IMPETUS Afea Solver_(10).非线性动力学问题求解.docx 冲击动力学仿真软件:IMPETUS Afea ...
2. **Ability**: 此名词指的是某人的才能或技能,如:She possesses the ability to solve complex problems. 3. **Abnormal**: 形容词,用于描述不符合正常标准或行为异常的情况,如:The child's behavior seemed...
1. 实验中需要找到解决问题的方法(We’ll have to find out a way to solve the problem.) 2. 是否要在咖啡中加糖(Will you add more sugar to your coffee?) 3. 回忆过去游泳的河流(This is the river where I...
It is also meant for those familiar with Apache Maven, but want to understand the finer nuances of Maven and solve specific problems. What You Will Learn Install Apache Maven successfully on your ...
例如:She is able to solve the problem, but he is unable due to his disability. 2. **about**: 关于,常用于"be about to do sth."结构,表示即将做某事。如:We are about to start the exam. 3. **above/...
2. **able**: 形容词,意为“有能力的,能干的”,如`He is able to solve the problem.`(他能解决这个问题。) 3. **abolish**: 动词,用于“废除”法律、规定或习惯,如`The old law was abolished last year.`...
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
15. **solve**: 动词,表示解决问题,如解决交通难题(We finally solved the difficulty of transportation)。 16. **solution**: 名词,解冑或答案,如找到问题的解决方案(Who can solve the mathematical ...
相关名词有 "solution" 解决方案,动词 "solve" 解决问题,形容词 "soluble" 表示可溶的。 9. **Absent**: 意为“缺席的”,如 "be absent from the meeting" 表示缺席会议。与其相反的动词 "attend" 表示出席。 ...
例句:She attempted to solve the difficult problem on her own. 12. attend(参加):参与活动或会议。 例句:I will attend the conference next week. 13. attract(吸引):引起注意或兴趣。 例句:The ...
《Java解惑(中文版)》是一本专为Java初学者设计的学习资料,旨在帮助读者解答在学习Java过程中遇到的各种困惑。"solve65p"可能代表这本书包含65个问题或主题,每个都深入浅出地进行了讲解,旨在解决初学者在编程...
29. solve(解决):找出并执行解决问题的方法。 30. confuse(使困惑):使人感到混淆或不明白。 【重点短语复习】 1. put forward(提出):提出意见、建议或理论。 2. draw a conclusion(得出结论):根据已知...
1. **able**: 形容词,意为“有能力的”,常用于表达某人具备做某事的能力,如:She is able to solve complex math problems. (她能解决复杂的数学问题。) 2. **abnormal**: 形容词,表示“不正常的”,常用于描述...
- `ability`: 指人或物具有的能力,如:`She has the ability to solve complex problems.` - `enable`: 使某人具有做某事的能力,如:`The new technology enables us to communicate faster.` - `capable`: 也...