如何在不同jvm底下生成heapdump.doc_第1页
如何在不同jvm底下生成heapdump.doc_第2页
如何在不同jvm底下生成heapdump.doc_第3页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

如何在不同jvm底下生成heapdump问题分析: 发现在AppSvr01下面有heapdump.*.phd和javacore.*.txt文件产生,有时会很快将空间充满产生的原因: 生产这两个文件,说明有OutOfMemory发生,可以查看SystemErr.log确定发送的愿意,是参数设置有问题,还是程序有内存泄露。 首先查看SystemErr.log”确定内存溢出的原因,是PermSize太小,还是Nativethread无法创建,前者用MaxPermSize调整(IBM JDK没有这个参数),后者调小最大堆大小或者Xss调整每个线程非配内存的大小。 如果是常见的堆溢出,确保OutOfMemory时能生成heapdump文件,用Dumpanalyzer或者MDD4J分析dump文件,找到堆中占用空间总数最大的(或数量最多的)对象。然后调整堆范围到一个比较小的区间,比如256M至384M,重新启动服务器,在运行1小时后手动做一次heapdump,运行4小时后做一次heapdump,运行8小时后做一次(间隔仅做参考)。然后分析一下三者的区别,看看那个对象数据增长很多,占用空间增加很大。结果OutOfMemory时候的分析,应该能锁定问题的源头。1、IBM JDK for weblogic用ibm的jvm应该在startWebLogic.sh上加入以下的代码 IBM_HEAPDUMP=true export IBM_HEAPDUMP IBM_HEAPDUMP_OUTOFMEMORY=true export HEAPDUMP_OUTOFMEMORY2、sunJDKtomcat启动时增加 HeapDumpOnOutOfMemoryError Option此参数需要Java SE release 5.0 update 7 或以上支持设置示例: set JAVA_OPTS=%JAVA_OPTS% -server -Xms512m -Xmx800m -XX:PermSize=64M -XX:MaxPermSize=128m -Djava.awt.headless=true -XX:+HeapDumpOnOutOfMemoryError测试内存溢出时可以把-Xms和-Xmx等的值相应调低即可.文件默认产生在tomcat/bin目录下如增加HeapDumpOnCtrlBreak Option就可以通过ctrl+break或收到SIGQUIT生成heapdump文件此参数需要Java SE release 5.0 update 14 或以上支持设置示例: set JAVA_OPTS=%JAVA_OPTS% -server -Xms512m -Xmx800m -XX:PermSize=64M -XX:MaxPermSize=128m -Djava.awt.headless=true -XX:+HeapDumpOnOutOfMemoryError -XX:+HeapDumpOnCtrlBreak参数介绍:HeapDumpOnOutOfMemoryError OptionThe -XX:+HeapDumpOnOutOfMemoryError command-line option was introduced in Java SE release5.0 update 7. This option tells the HotSpot VM to generate a heap dump when the first thread throws ajava.lang.OutOfMemoryError because the Java heap or the permanent generation is full. There isno overhead in running with this option, and so it can be useful for production systems whereOutOfMemoryError takes a long time to surface.The heap dump is in HPROF binary format, and so it can be anaylzed by any tool that can import thisformat, for example the Heap Analysis Tool (HAT).By default the heap dump is created in a file called java_pid.hprof in the working directoryof the VM, where is the process ID. You can specify an alternative file name or directory withthe -XX:HeapDumpPath= option. For example, -XX:HeapDumpPath=/disk2/dumps will cause theheap dump to be generated in the /disk2/dumps directory.HeapDumpOnCtrlBreak OptionThe -XX:+HeapDumpOnCtrlBreak command-line option was introduced in Java SE release 5.0 update 14. This option tells the HotSpot VM to generate a heap dump when a Ctrl-Break or SIGQUIT signalis received. This provides a way to trigger a heap dump on demand.The heap dump is in HPROF binary format, and so it can be anaylzed by any tool that can import thisformat, for example the Heap Analysis Tool (HAT). The heap dump contains only live objects.By default the heap dump is created in a file called java_pid.hprof.in the working directory of the VM, where is the process ID, and . is theapproximate time when the heap dump was generated.You can specify an alternative file name or directory with the -XX:HeapDumpPath= option. Forexample, -XX:HeapDumpPath=/disk2/dumps will cause the heap dump to be generated in the/disk2/dumps directory.If

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论