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?
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?
SciTech Software AB
Users browsing this forum: Bing [Bot] and 5 guests