Wednesday, 11 September 2013

.NET - high memory usage by clr.dll and native heaps

.NET - high memory usage by clr.dll and native heaps

I have been performing memory leak analysis using DebugDiag for a .NET
application which has shown continuous increase in memory.
After several test dumps and then capturing dumps over a day, I see that
the module clr.dll has 5.08 MB of allocations in first dump, 286.4 MB of
allocations in second and 609.56 MB in the third.
Specifically, the rise is in allocations caused by
clr!DoNDirectCall__PatchGetThreadCall+7b which has 894.33 KB allocation in
first, 280.85 MB in second and 601.13 MB in third. Here are some of the
call stacks from the third dump -
Call stack sample 1
Address 0x00730074`00210048
Allocation Time 00:09:03 since tracking started
Allocation Size 34 Bytes
Function Source Destination
clr!DoNDirectCall__PatchGetThreadCall+7b
mscorlib_ni+b9597b
mscorlib_ni+b940ed
mscorlib_ni+b9513e
System_Management_ni+dc561
System_Management_ni+aa364
System_Management_ni+e4616
Call stack sample 2
Address 0x00730074`00210048
Allocation Time 00:05:00 since tracking started
Allocation Size 34 Bytes
Function Source Destination
clr!DoNDirectCall__PatchGetThreadCall+7b
mscorlib_ni+9bb2cc
mscorlib_ni+b934aa
System_Management_ni+dc714
System_Management_ni+acb99
System_Management_ni+e41a5
Call stack sample 3
Address 0x00730074`00210048
Allocation Time 00:05:00 since tracking started
Allocation Size 34 Bytes
Function Source Destination
clr!DoNDirectCall__PatchGetThreadCall+7b
mscorlib_ni+9bb2cc
mscorlib_ni+b934aa
System_Management_ni+dc714
System_Management_ni+acb99
System_Management_ni+e41a5
0x6448017AE50
What could be causing this and how do I find out more about this ?
Also, my code uses the avaliable C# methods to run remote WMI queries and
retrieve that data.
In addition, my Native Heaps usage also increases. There are 40 native
heaps for my application. The memory usage of the last heap always
increases. Its total usage goes from 67.57 MB to 1.59 GB to 3.82 GB. What
could be the cause of this, and is this related to clr's usage ?

No comments:

Post a Comment