Knowing and tracing application memory consumtion and leaks?
-
I've got a long running application what reads some data and store it in Dictioinary field. I persist that class containing dictionary using serialization. During the application run there is small memory consumtion going on about 1 Mb a minute. However serialized object grows about 100 bytes a minute or less. What is the best and fastest way to discover the reason of the leak? Is it possible to determine exact size of that class with Dictionary collection in memory during the program run?
Чесноков
-
I've got a long running application what reads some data and store it in Dictioinary field. I persist that class containing dictionary using serialization. During the application run there is small memory consumtion going on about 1 Mb a minute. However serialized object grows about 100 bytes a minute or less. What is the best and fastest way to discover the reason of the leak? Is it possible to determine exact size of that class with Dictionary collection in memory during the program run?
Чесноков
You'd use a .NET memory profiler like these[^]. If you're looking in TaskManager to tell you what you're app is using, don't. TM is telling you how much memory is RESERVED by the .NET CLR instance running your app, not the app itself.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak -
You'd use a .NET memory profiler like these[^]. If you're looking in TaskManager to tell you what you're app is using, don't. TM is telling you how much memory is RESERVED by the .NET CLR instance running your app, not the app itself.
A guide to posting questions on CodeProject[^]
Dave Kreskowiakthank you for the link... are there some tools in visual studio or windows to trace the reason of the leak?
Чесноков
-
thank you for the link... are there some tools in visual studio or windows to trace the reason of the leak?
Чесноков
Visual Studio 2010 Premium and Ultimate editions are the only ones with a memory profile built in. All other editions of 2010 and all editions of Visual Studio 2008 and below do not have a memory profiler at all. Windows doesn't have any debugging tools to do this either. But, you are going to have to learn to use the tools effectively. It's not just as simple as starting a profile session, run your app, and Viola!, there's your problem. You have to understand how .NET memory allocation works and how the object involved in your problem behave with respect to memory allocation.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak