Skip to end of banner
Go to start of banner

Debugging memory issues

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Scenario using JProfiler to debug memory issues on your own machine

  1. Download the trial version of JProfiler http://www.ej-technologies.com/download/jprofiler/trial

Scenario OutOfMemory exception due to heap space on the Bamboo build

  1. kick off a build on bamboo
  2. ssh to the host, wait till it gets to the point in the build you are interested in (watch the real time logs) and then take a dump of the JVM heap like so
    ~/>ssh -i elasticbamboo.pk root@ec2-174-129-52-168.compute-1.amazonaws.com
    [root@ip-10-101-51-19 ~]# jps
    1406 ElasticAgentBootstrap
    5830 Jps
    1798 Launcher
    2618 surefirebooter897216346249478641.jar
    [root@ip-10-101-51-19 ~]# jmap -dump:format=b,file=heapdump.bin -F 2618
    Attaching to process ID 2618, please wait...
    Debugger attached successfully.
    Client compiler detected.
    JVM version is 17.0-b16
    Dumping heap to heapdump.bin ...
    Finding object size using Printezis bits and skipping over...
    Finding object size using Printezis bits and skipping over...
    Finding object size using Printezis bits and skipping over...
    Finding object size using Printezis bits and skipping over...
    Finding object size using Printezis bits and skipping over...
    Finding object size using Printezis bits and skipping over...
    Finding object size using Printezis bits and skipping over...
    Finding object size using Printezis bits and skipping over...
    Finding object size using Printezis bits and skipping over...
     Heap dump file created
    [root@ip-10-101-51-19 ~]#exit
    ~/>scp -i elasticbamboo.pk root@ec2-50-17-14-228.compute-1.amazonaws.com:~/heapdump.bin .
    
  3. Visualize the dump
    ~/Documents/AWSConfig/Sage/AtlassianCreds>jhat -J-Xmx1024m heapdump.bin 
    Reading from heapdump.bin...
    Dump file created Tue Dec 20 14:17:03 PST 2011
    ...
    WARNING:  Failed to resolve object id 0x73ff4960 for field table (signature L)
    WARNING:  Failed to resolve object id 0x740465c0 for field table (signature L)
    Chasing references, expect 1800 dots.................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... ....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
    Eliminating duplicate references........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
    Snapshot resolved.
    Started HTTP server on port 7000
    Server is ready.
    
  4. In your browser go to http://localhost:7000/showInstanceCounts/
  5. Click on one of the "instance" links near or at the top
  6. Use “Reference Chains from Rootset” (Exclude weak refs) to see who’s holding the instance
  • No labels