1

The top memory consuming function is DomainBoundILStubClass.IL_STUB_PInvoke(UInt32). The module's base address is 0x00000000 so that's probably why it's the "UNKNOWN_MODULE" module. Here are the function details:

Function details

Function   DomainBoundILStubClass.IL_STUB_PInvoke(UInt32)  
Source Line  
Allocation type   C/C++ runtime allocation(s)  
Allocation Count   525709 allocation(s)  
Allocation Size   51.63 MBytes  
Leak Probability   35%

There are zero stacks with this function at the top of the stack trace or near the top so I don't know what's calling it.

I'm assuming this is aggregating all the pinvoke'd calls to malloc. Is that correct? And since the "Allocation type" is C/C++, would that also include pinvoke'd calls to operator new?

User0123456789
  • 760
  • 2
  • 10
  • 25
Marc Sherman
  • 2,303
  • 14
  • 22
  • Can't you put a breakpoint on that function to know what's calling it? Is it 64 bit or 32 bit (important if we want to get info from the stack or registers)? Are you making lots of network requests (missing `using` statements somewhere)? Which `[DllImport]`s are you using? Is it .NET 2 or 4 (AFAIK they behave differently regarding PInvoke)? As it stands, the question is too broad and unclear to answer. – Thomas Weller Mar 22 '16 at 23:32
  • I can't run it under a debugger because that will kill performance and this is a live production service. Why network requests? These are pinvoke calls generated by the managed C++ compiler to, I'm pretty sure, calls to operator new and/or malloc. In fact, I coded up a test managed C++ app with calls to new and malloc and this is exactly the function generated to call them. – Marc Sherman Mar 23 '16 at 17:43
  • Ok, thanks. Although it was tagged C++ I somehow got the impression that your code were C#. Sorry for that. I'm hardly familiar with managed C++, but if it calls new or malloc, wouldn't UMDH be the tool of choice then? – Thomas Weller Mar 23 '16 at 19:16
  • I started with UMDH and it showed leaks but their sum was much smaller than overall private bytes growth. That reminded me that UMDH only works with the default Windows heap manager ("Advanced Windows Debugging", p. 469). That book mentioned another tool, LeakDiag, which supports six allocators. My intention was to use LeakDiag but my brain remebered it as DebugDiag. Maybe I should try LeakDiag. – Marc Sherman Mar 24 '16 at 13:21

0 Answers0