I used jprofiler to detect memory leak for my client code.At starting the memory used by java.util.hashmap$entry was increasing drastically up to 1700KB. after that it decreased too. The Heap dump show java.lang.ref.finalizer was using maximum of memory. What doest it conclude? When i try to find finalize() in my source code it was not there. in HTML file finalize() was used like this. finalize, what does it mean? The cause is finalize() or the reference hashmap$entry is causing the leak?
-
There is no such thing as `java.lang.ref.finalizer` or `java.util.hashmap$entry`. Please update the question with the REAL class names or method names or whatever they are. – Stephen C Oct 31 '12 at 07:07
-
Why do you think there is a memory leak? Does your application give you an `OutOfMemoryException`? Perhaps you simply need to change the amount of memory you start the application with. – radimpe Oct 31 '12 at 07:45
2 Answers
If you want to look for a memory leak, you should look at how much memory is used after a Full GC, twice if you have lots of finalisable references, otherwise you are likely to see lots of temporary objects which don't matter.
I suspect neither of the data types you are seeing are a problem esp if they go down in usage periodically. Look for consumption which only goes up.

- 525,659
- 79
- 751
- 1,130
-
Thanks Peter. Actually almost every data data types memory consuming value is increasing. I mean to say that if consumption is now 50kb after 10 min it's 56kb and just after performing gc the consumption is 53kb means after 10 min 3 kb memory increased and periodically it increased in this manner only. Does it confirm that my application has memory leak? – Rajesh Kumar Nov 05 '12 at 10:28
-
Many MB increase after a Full GC might be a leak. I wouldn't worry about a few KB as it could be "noise". If everything is increasing it points to a common factor e.g. a collection which holds all these increasing classes. – Peter Lawrey Nov 05 '12 at 11:33
What does it conclude?
First, your so-called "evidence" is garbled, and it is not clear what the ungarbled version should be. However, based on some guesswork ... I can see no clear signs of a memory leak at all.
Rather, it looks like what would happen if you had a large WeakHashMap
that either became unreachable, or that got cleared out because the GC noticed that the heap was getting too full.
However, my guesswork could be wrong, and there could be a leak here ...
The cause is finalize() or the reference hashmap$entry is causing the leak?
Not necessarily either. (In fact, if there is really a storage leak at all, it is unlikely that either of those is the direct cause.)

- 698,415
- 94
- 811
- 1,216
-
Thanks Stephen. Actually almost every data data types memory consuming value is increasing. I mean to say that if consumption is now 50kb after 10 min it's 56kb and just after performing gc the consumption is 53kb means after 10 min 3 kb memory increased and periodically it increased in this manner only. Does it confirm that my application has memory leak? – Rajesh Kumar Nov 05 '12 at 10:29
-
A single data-point is not evidence of a memory leak. A consistent long term trend would be evidence of a leak. – Stephen C Nov 05 '12 at 21:49