Question about memory profiling of collections

Code and memory profiling for .NET developers.

Question about memory profiling of collections

Postby jwebsdale » Tue Mar 10, 2009 12:22 pm

I'm currently having issues with tracking down the memory usage of a simple collection class in a WPF application. I'm using C#, .NET 3.5.

I'm creating a local List collection of a simple object that consists of 4 strings. I'm not actually adding any items to the list, but even though the List is defined as a local variable to the method, it would appear that the Memory Profiler is reporting that I have a live object of the List after the method and exited. I've tried forcing a GC but the List object remains.
Having replaced the List with an ObservableCollection, the results are the same.
Replace that with a simple array of the same simple object, and the Memory Profiler reports that I don't have any list instances of that array.
Is there a known issue with the Memory Profiler and Collections, and am I chasing a memory leak that isn't really there?


Posts: 1
Joined: Tue Mar 10, 2009 12:13 pm
Location: Cambridge, UK

Postby Chris.Allen » Thu Mar 12, 2009 4:23 pm

Hello Jonathan,

no there are no known issues of the memory profiler giving spurious information of this nature. Something is still maintaining a reference to those generic collections. I think you should be able to get a "second opinion" on this simply by loading up those collections with multiple objects and observing the memory usage in Windows task manager.

Hope this helps.
Posts: 579
Joined: Thu Mar 12, 2009 3:17 pm

Return to ANTS Profiler Previous Versions

Who is online

Users browsing this forum: No registered users and 0 guests