>> Also, is there such thing as a memory leak in C#?
Yes; there's a risk of memory leak in all languages - even those with automated garbage collection (such as C# and Java).
I've never ran into any serious leaks myself, but obvious things such as not closing streams, not reusing objects, and so on, all add up.
Here's a good .NET memory profiler:
http://www.scitech.se/memp
There's a trial version for it.
This too is supposed to be good:
http://www.automatedqa.com
As for retrieving the amount of memory allocated by your program, use the GC#GetTotalMemory(bool) method:
http://msdn.microsoft.com/
..
"Retrieves the number of bytes currently thought to be allocated. A parameter indicates whether this method can wait a short interval before returning while the system collects garbage and finalizes objects."
Main Topics
Browse All Topics





by: steelheart38Posted on 2005-11-11 at 01:50:55ID: 15272368
I'm always guilty of not disposing unused objects and sometimes manual garbage collection that hits performance sometimes