Running jmap to dump the java heap for the OneClickService.exe

Document ID : KB000049734
Last Modified Date : 14/02/2018
Show Technical Document Details

Description:

Jmap is a java tool used for memory profiling. It is used to take a heap snapshot (dump the heap without affecting the running process).


However, when running jmap against the OneClickService.exe process on Windows the following error is returned:

   > jmap -dump:format=b,file=heap.hprof 4820       
   4820: Not enough storage is available to process this command  

This error happens because jmap cannot run against a running service.

Solution:

To resolve this issue, stop the Spectrum tomcat service, open a bash shell and navigate to the $SPECROOT/tomcat/bin directory and
launch OneClickService.exe as follows:

       > OneClickService.exe --start --debug   
   Debugging "SpectrumTomcat"  

Let tomcat initialize and once the issue reproduces you can now run jmap against the OneClickService.exe process since it is now running in debug mode. The output will be similar to this:

       > jmap -dump:format=b,file=heap.hprof < PID of OneClickService.exe>       
       Dumping heap to C:\win32app\Spectrum\Java\bin\heap.hprof ... 
   Heap dump file created  

The jmap tool should be used at the recommendation of CA Spectrum support. Resulting heap.hprof files can be sent to CA Spectrum support for analysis.