Private memory managed heap keeps growing

Use this forum to discuss subjects that don't belong in the other forums.
Post Reply

Private memory managed heap keeps growing

Post by memoryproblem » Wed Jun 08, 2005 3:57 pm

I am trying to track down if my app has a memory leak. I ran it through the profiler and found that the objects I expect to be live and expect to be removed are behaving as expected. But my memory consumption does not come down. I even tried calling GC.Collect at the end of my application but I don't see the numbers for the private memory managed heap come down.

My app basically has the following sequence. Start the application. open a customer object. close the customer object without doing anything.

When I run through the profiler I see that the Customer object has 0 live instances when the app starts. Gets one live instance after I take a snapshot after opening a customer. and then 0 live and 1 removed when I take another snapshot after closing. Does this mean that the object is available for garbage collection at that point? Why then does the GC not collect it even when i force a Collect call. I take another snapshot after the GC.Collect and I still see the managed heap at the same level as when a customer is loaded. I do not have any finalizers in my objects nor am I using any resources within them that need to be disposed. Am I interpreting the profiler numbers correctly?


Post by Guest » Fri Jun 10, 2005 12:28 pm


If the profiler tells you that instances of a class have been removed, it means that they have been garbage collected; they're not just eligible for garbage collection. However, the instances may get collected earlier than usual when collecting a snapshot, since a full garbage collect is performed when a snapshot is collected.

In order to optimize performance, the managed heap is not reduced everytime an instance is garbage colllected. If you're looking for a memory leak, you should look at the total size of the live instances. If this number doesn't increase, then you don't have a managed memory leak.

Does the memory usage of your application keep increasing, or does it level off after a while?

Best regards,

Andreas Suurkuusk
SciTech Software AB

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 3 guests