NIVESH SENGAR
NIVESH SENGAR

Reputation: 1333

JProfiler : After Garbage Collector collects the object. If any Live object is there on heap, is it Memory Leak?

I am using JProfiler for profiling of my application. I have noticed when I run Garbage collector all the marked Recorded Object becomes Green and after some time it again face some difference in Object created and Destroyed.
By the way My Application is still running at this time, Does my application facing a problem of memory leak or this is usual.
There is some snap shot that may be help you understanding situation
enter image description here

Above is the snap shot when I run Garbage Collector...

But After some time these bars becomes Green and Red Partially...

Upvotes: 3

Views: 1647

Answers (1)

Pavan
Pavan

Reputation: 1247

Typically, you can say your memory is leaking, if the size occupied by a certain object, say char[], keeps growing inspite of GC.

It is generally OK if after GC you see "Red" again for certain type of objects. I am assuming your application is doing some work and generating garbage. So, that itself is not an issue. However, if the size keeps growing, that might be a problem.

A good strategy is to note the allocation size of a given object, say char[], before and after GC and see how much objects are being collected. Repeat this exercise over a period of time. If the size does not grow massively, you should be fine.

The important point here though, is, make sure the load profile (number of requests, background jobs etc) is the same. Otherwise, your memory profiling results wont be an apples to apples to comparison.

Upvotes: 2

Related Questions