Thursday, May 23, 2013

How to print GC details into a file for your program?

 For your local program (for example - say you have written a standalone DOM xml parser or any memory intensive program on which you want to check GC*  usage).

In RAD (for IBM JVM) --> right click on the java class --> goto "Run As" --> goto "Run configurations" --> goto "Arguments" tab in the pop-up --> set the below under VM arguments

-Xverbosegclog:D:\Your_Path\Your_Sub_Path\jvm.log

On a Sun JVM:
  -Xloggc:C:\Your_Path\jvm.log -verbose:gc -XX:+PrintGCDateStamps
(if there are spaces in folder or file names, it will be interpreted as another VM argument)
Then Run your program. GC details will be logged in that file (jvm.log in this case)

* GC- Garbage Collector
Referene:

http://stackoverflow.com/questions/1161647/how-to-redirect-verbose-garbage-collection-output-to-a-file

No comments:

Post a Comment