dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: Java
Expertise: Advanced
Oct 13, 2004

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


Monitoring Garbage Collection in the JVM

Big applications create huge numbers of objects. Though Java manages the memory allocation and de-allocation for these objects, sometimes this huge number can result in memory leak problem. To monitor when and how much garbage collection is happening, use the following example method:
  1. Suppose you start your application as:
    
    java MyMainClass option1 option2.....
    
  2. To determine when garbage collection is happening, start your application as:
    
    java -verbose:gc MyMainClass option1 option2.....
    
  3. If garbage collection takes place, your output should show something like this:
    
    [GC 511K->105K(1984K), 0.0029585 secs]
    
The numbers before and after the arrow indicate the combined size of live objects before and after garbage collection. The number in parenthesis is the total available space, which is the total heap minus one of the survivor spaces.

Note: Remember that the figures in the output depend on your application and JVM.

Amit Tuli
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date