Suppose I have a WinForms .NET application written in C#. This application allocates large amounts of memory from both the managed and unmanaged heaps. I can (relatively) easily figure out the allocation details (who, when, how much, etc.) of the managed objects using tools like Red Gate ANTS Profiler (which I have not used) or JetBrains dotTrace.
Where I run into trouble is when the managed objects use significant native resources (Image for example, or large COM objects) or when I call out to unmanaged third party libraries with significant memory needs. Thus far I really have to do some detective work to figure out 1) is it the managed or unmanaged code that is the memory hog and 2) who is using so much of the unmanaged heap.
The only technique I have at the moment is to set performance counters in perfmon that compare the managed vs. unmanaged heap sizes, allocations, etc. If the unmanaged heap continues to grow while the managed heap is steady, I know to start looking at the unmanaged libraries and/or .NET objects that consume native resources.
What is the best combination of tools and techniques to help developers with significant amounts of managed and unmanaged code?
UPDATE: To be more clear, I would like to know how to detect memory problems (high usage, leaks) in unmanaged code being called from managed code. Products like dotTrace, I believe, only track managed objects.