Java Profiling Memory Leak

Tips:

  1. Invoke the JVM with the -verbose:gc or the -Xloggc option.
  2. Use JTune to graph the log.
  3. Invoke the JVM with the -Xrunhprof:heap=sites option to run the built-in hprof to find out the leaking/leaded objects classes. With jdk 1.6, use -agentlib:hprof=heap=sites instead.
  4. Use weak references to hold the leaked object in a global map instead of strong references.
Advertisements

About minghuasweblog

a long time coder
This entry was posted in All, Java/JavaScript and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s