As far as I can tell, this is isn't possible, so I'm really just hoping for a left field undocumented allocation hook function. I want a way to track allocations like in _CrtSetAllocHook, but for C#/.net. The only visibility to the garbage collector/allocation appears to be GC.CollectionCount. Anyone have any other .net memory mojo?
+5
A:
The CLR has a 'profiling API' that hooks into pretty much everything - it is what the commercial .NET memory profiling products use, I believe. Here is an MSDN link to the top level of the documentation: .NET Framework General Reference: About the Profiling API
See this MSDN magazine article for an introduction to the memory piece: Inspect and Optimize Your Program's Memory Usage with the .NET Profiler API
McKenzieG1
2008-09-08 18:57:13
A:
I would just use Red Gate's ANTS Profiler. It will tell you a lot about what's going on in memory without you having to learn the profiling API yourself.
Jonathan Allen
2008-09-08 20:33:10