转载自:http://devops-abyss.blogspot.com/2010/03/create-java-heapdumps-with-help-of-core.html
Hi,
for some time I had the problem, that taking Java heap dumps with
jmap took too long. When one of my tomcats crashed by an OutOfMemoryException, I
had no time to do a heap dump because it took some hours and the server had to
be back online.
Now I found a sollution to my problem. The initial idea
came from this
post. It had a solution for Solaris, but with some googling and try and error I
found a solution for linux too.
- create a core dump of your java process with gdb
gdb
--pid=[java pid]
gcore [file name]
detach
quit
- restart the tomcat or do whatever you like with the java process
- attach jmap to the core dump and create a Java heap dump
jmap
-heap:format=b [java binary] [core dump file]
- analyze your Java heap dump with your prefered tool
When you get
the following error in step three:
Error attaching to core file: Can't attach to the core
file
This might help:
In my case the error apeared because
I used the wrong java binary in the jmap call. When you are not sure about your
java binary, open the core dump with gdb:
gdb
--core=[core dump file]
You will get an output similar to
this one:
GNU gdb 6.6
Copyright (C) 2006 Free Software Foundation,
Inc.
GDB is free software, covered by the
GNU General Public License, and you are
welcome to change it and/or distribute copies of it
under certain conditions.
Type "show
copying" to see the conditions.
There is
absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i586-suse-linux"...
(no debugging symbols found)
Using host libthread_db library
"/lib/libthread_db.so.1".
warning:
core file may not match specified executable file.
(no debugging symbols found)
Failed to read a valid object file image from
memory.
Core was generated by
`/opt/tomcat/bin/jsvc'.
#0 0xffffe410 in
_start ()
What you are looking for is in this line:
Core was generated by
`/opt/tomcat/bin/jsvc'.
Call jmap with this binary and you
will get a heapdump.
分享到:
相关推荐
JStack和Java Thread Dumps分析
Java线程转储分析: 《Analyzing Java Thread Dumps.pdf》 《Java Thread Dumps 分析.pdf》
Test library to introspecting your Java heap via heap dumps. HeapUnit can capture heap dump of own JVM scan content of dump reconstruct Java objects from heap dump Example Code snippet below dumps ...
Thread dumps(线程转储)能帮助我们判断 CPU 峰值、死锁、内存异常、应用反应迟钝、响应时间变长和...在这篇文章当中,总结了7中抓取 Java Thread Dumps 文件的方式,分享给大家,希望对大家学习Java能够有所帮助。
200-125 Exam Dumps with PDF and VCE Download (351-end).pdf
Use the Memory Analyzer to analyze productive heap dumps with hundreds of millions of objects, quickly calculate the retained sizes of objects, see who is preventing the Garbage Collector from ...
Use the Memory Analyzer to analyze productive heap dumps with hundreds of millions of objects, quickly calculate the retained sizes of objects, see who is preventing the Garbage Collector from ...
Java Questions for SCJp
The Art of Debugging illustrates the use of three of the most popular debugging tools on Linux/Unix platforms: GDB, DDD, and Eclipse. In addition to offering specific advice for debugging with each ...
[June-2016] New 200-125 Exam Dumps with PDF and VCE Download.pdf
Accelerated Windows Malware Analysis with Memory Dumps(2nd) 英文无水印pdf 第2版 pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本...
For a process to access 3 GB of address space, the executable image must have been linked with the /LARGEADDRESSAWARE flag or modified using Imagecfg.exe. It should be pointed out that SQL Server was ...
Programs the EEPROM/NVM with only the MAC address of macaddr without changing the rest of the EEPROM/NVM. /NUM is optional and I40E specific - it defines target PF. /A <addrfile> or /address ...
Verify digital signatures of files, of running programs, and of the modules loaded in those programs Use Autoruns, Process Explorer, Sigcheck, and Process Monitor features that can identify and clean ...
Modbus Poll Screen dumps(使用说明) This screen dump show modbus poll with 2 data views open. The first line shows the number of polls, errors, slave number, function and scan rate. When holding ...
对java产生的ThreadDump文件进行定位分析,找出问题根本原因。
PCNSA dumps
The framework is intended to introduce people to the techniques and complexities associated with extracting digital artifacts from volatile memory samples and provide a platform for further work into ...
Logcat is command-line tool that dumps a log of system messages, messages that you have written from your app with the Log class. Cat, logically, it means concatenate but it also means World's most ...
Analyzing OSGi heap dumps 283 8.4 Dangling services 287 Finding a dangling service 287 ■ Protecting against dangling services 288 8.5 Summary 290 9 Managing bundles 292 9.1 Versioning packages and ...