Are there any methods to trace how much memory is allocated, de-allocated and retrieved by GC for a particular module in C# .net ?
I want to trace out the possible memmory leaks in my module. I am getting occasional System out of memory exceptions in production.
You should use a memory profiler to profile memory allocations.
I've used JetBrains dotTrace, which has a nice mode of taking two snapshots at different times and showing which objects were allocated but not collected between those two snapshots. Allows for easy finding for memory leaks, where you keep allocating new instances and not collect them.
To view the difference between two application memory states, you can mark the start and the end of a time interval, then capture a difference snapshot which shows how much memory was allocated and released during the marked time interval. The view can be filtered to show only live, new, or dead objects, or the difference between new and dead objects.