📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

📚 Interview question

Private Bytes keeps growing but the managed heap is flat in your .NET Framework app. What does that tell you, and how do you find a native leak?

Senior Debugging Advanced

🎯 Key points

  • Growth outside the GC heap
  • Check thread and handle counts first; each leaked thread holds a stack
  • DebugDiag leak tracking, WPR heap tracing in WPA, or Visual Studio native memory snapshots
  • Managed wrappers in the dump: Bitmap, SafeHandle, RCWs
  • dotnet-counters and dotnet-dump for the managed view on modern .NET
  • Dispose wrappers deterministically; isolate unfixable native components in another process

⏱ 30-second answer

It means the growth is outside the GC heap: native allocations from COM components, GDI+ (System.Drawing), unmanaged libraries, leaked threads (each reserves a stack, 1 MB by default on Windows) or pinned buffers. Check thread count and handle count counters first, because leaked threads and handles are the most common cause. On .NET Framework, use DebugDiag with a leak-tracking rule, or Windows Performance Recorder heap tracing analysed in WPA (or the Visual Studio native memory snapshot), which record native allocation call stacks. In a managed dump, look for many Bitmap, SafeHandle or COM RCW objects that wrap native memory. On .NET 10 the same approach applies, with dotnet-counters and dotnet-dump for the managed side. Fix by disposing wrappers deterministically or isolating an unfixable native component in a separate process.

🔍 What the interviewer is checking

Checks they can go beyond SOS when the leak is native

↩ Usually asked after

More in Legacy Technologies

Last updated 23 Nov 2026.

🌐 Sangam's Webring

⏪ Previous 🏠 Main Next ⏩
💬 Chat with me