Using Jconsole for Memory Leak

16,482

Solution 1

I think I've found the answer to my question. The 'Total blocked' and 'Total waited' are simply counts for the number of times the thread waited or was blocked. JConsole is taking this information from ThreadInfo.

Blocked count is the total number of times that the thread blocked to enter or reenter a monitor. I.e. the number of times a thread has been in the java.lang.Thread.State.BLOCKED state.

Waited count is the total number of times that the thread waited for notification. i.e. the number of times that a thread has been in the java.lang.Thread.State.WAITING or java.lang.Thread.State.TIMED_WAITING state.

Solution 2

Name: Finalizer State: WAITING on java.lang.ref.ReferenceQueue$Lock@1b79cfd Total blocked: 4,049 Total waited: 1,579

The ReferenceQueue is maintaining a reference for all unused objects (waiting for finalization), in other words there is 4049 objects waiting for a garbage collection.

When hunting for memory leaks, be sure to do a full GC (or many GC until nothing can't be reclaimed) before doing the dump

Share:
16,482

Related videos on Youtube

Silent Walker
Author by

Silent Walker

Updated on May 09, 2022

Comments

  • Silent Walker
    Silent Walker over 1 year

    I'm trying to diagnose some memory issues in our J2EE server. I've setup jconsole on our live server and I'm trying to monitor the status of the tomcat server through it. I've a quick question about the Threads tab in jconsole. I can see a thread named Finalizer in the threads list. The 'Total blocked' number in this thread keeps on increasing. For example, it's now 4,049, an hour ago it was 3,867.

    Name: Finalizer
    State: WAITING on java.lang.ref.ReferenceQueue$Lock@1b79cfd
    Total blocked: 4,049 Total waited: 1,579

    What does this thread mean? Is it somehow related to the GC? I've downloaded a heap dump where it shows number of objects pending for finalization is zero.

    The max heap size of my server is 200MB at the moment, the heap size remains between 100 and 150 MB and when I click on 'Perform GC', I can see some heap space getting freed. However this doesn't change the amount of memory taken by this tomcat process in windows task manager, which is consuming over 700 MB right now.

    Any tips on how I should go about it will be much appreciated. Please ask me questions if you need further info on my server setup.

    Thanks in advance.

  • Silent Walker
    Silent Walker almost 13 years
    Well, I've used the Detect Deadlock feature in jconsole but couldn't find anything. It says no deadlock detected.
  • Silent Walker
    Silent Walker almost 13 years
    Thanks for your link. I've looked at that page before as well. It has a screen shot of the Finalizer thread that I'm talking about (Figure 3-8). However, it doesn't go into any detail about the thread, or the Total blocked, Total waited attributes.