w3wp Memory Leak ....
There was an ASP.net application running on IIS 6 and it consum memory till 1 GB ...
In the memory dumps and found many problems:
0:000> !FindDebugModules
Loading all modules.
Searching for modules built in debug mode...
...............
Searching for modules built in release mode with the /debug switch...
Done Seaching
Total 4 Debug modules
Total 0 release modules with the /debug switch
Don’t run production ASP.NET Applications with debug=”true” enabled
https://weblogs.asp.net/scottgu/archive/2006/04/11/442448.aspx
ASP.NET Memory: If your application is in production… then why is debug=true
https://blogs.msdn.com/b/tess/archive/2006/04/13/575364.aspx
And there sequential increase between 4 dumps going from 500, 600, 700 and 800 MB.
Mainly increase was in .Net <unknown>, Heap and Private mem Size:
Dump 1
!address -summary
--- Usage Summary ---------------- RgnCount ----------- Total Size -------- %ofBusy %ofTotal
Free 233 d1cd5000 ( 3.278 Gb) 81.96%
<unknown> 456 260b1000 ( 608.691 Mb) 82.36% 14.86%
Image 998 4c0a000 ( 76.039 Mb) 10.29% 1.86%
Heap 83 2c87000 ( 44.527 Mb) 6.02% 1.09%
Stack 114 980000 ( 9.500 Mb) 1.29% 0.23%
Other 9 32000 ( 200.000 kb) 0.03% 0.00%
TEB 38 26000 ( 152.000 kb) 0.02% 0.00%
PEB 1 1000 ( 4.000 kb) 0.00% 0.00%
--- Type Summary (for busy) ------ RgnCount ----------- Total Size -------- %ofBusy %ofTotal
MEM_PRIVATE 614 285cd000 ( 645.801 Mb) 87.38% 15.77%
MEM_IMAGE 1025 4e57000 ( 78.340 Mb) 10.60% 1.91%
MEM_MAPPED 60 ef7000 ( 14.965 Mb) 2.02% 0.37%
Dump 2
!address -summary
--- Usage Summary ---------------- RgnCount ----------- Total Size -------- %ofBusy %ofTotal
Free 234 ca612000 ( 3.162 Gb) 79.06%
<unknown> 469 2d0f3000 ( 720.949 Mb) 84.04% 17.60%
Image 991 4c0a000 ( 76.039 Mb) 8.86% 1.86%
Heap 89 32c7000 ( 50.777 Mb) 5.92% 1.24%
Stack 117 9c0000 ( 9.750 Mb) 1.14% 0.24%
Other 9 32000 ( 200.000 kb) 0.02% 0.00%
TEB 39 27000 ( 156.000 kb) 0.02% 0.00%
PEB 1 1000 ( 4.000 kb) 0.00% 0.00%
--- Type Summary (for busy) ------ RgnCount ----------- Total Size -------- %ofBusy %ofTotal
MEM_PRIVATE 636 2fc90000 ( 764.563 Mb) 89.12% 18.67%
MEM_IMAGE 1019 4e57000 ( 78.340 Mb) 9.13% 1.91%
MEM_MAPPED 60 ef7000 ( 14.965 Mb) 1.74% 0.37%
Dump 3
!address -summary
--- Usage Summary ---------------- RgnCount ----------- Total Size -------- %ofBusy %ofTotal
Free 281 bc405000 ( 2.941 Gb) 73.54%
<unknown> 573 38e0c000 ( 910.047 Mb) 83.96% 22.22%
Image 1235 5afa000 ( 90.977 Mb) 8.39% 2.22%
Heap 79 45bf000 ( 69.746 Mb) 6.43% 1.70%
Stack 153 cc0000 ( 12.750 Mb) 1.18% 0.31%
TEB 51 33000 ( 204.000 kb) 0.02% 0.00%
Other 9 32000 ( 200.000 kb) 0.02% 0.00%
PEB 1 1000 ( 4.000 kb) 0.00% 0.00%
--- Type Summary (for busy) ------ RgnCount ----------- Total Size -------- %ofBusy %ofTotal
MEM_PRIVATE 778 3cfad000 ( 975.676 Mb) 90.01% 23.82%
MEM_IMAGE 1263 5d47000 ( 93.277 Mb) 8.61% 2.28%
MEM_MAPPED 60 ef7000 ( 14.965 Mb) 1.38% 0.37%
Dump 4
!address -summary
--- Usage Summary ---------------- RgnCount ----------- Total Size -------- %ofBusy %ofTotal
Free 234 c18d1000 ( 3.024 Gb) 75.61%
<unknown> 470 350c1000 ( 848.754 Mb) 84.95% 20.72%
Image 999 4c76000 ( 76.461 Mb) 7.65% 1.87%
Heap 80 400f000 ( 64.059 Mb) 6.41% 1.56%
Stack 114 980000 ( 9.500 Mb) 0.95% 0.23%
Other 9 32000 ( 200.000 kb) 0.02% 0.00%
TEB 38 26000 ( 152.000 kb) 0.01% 0.00%
PEB 1 1000 ( 4.000 kb) 0.00% 0.00%
--- Type Summary (for busy) ------ RgnCount ----------- Total Size -------- %ofBusy %ofTotal
MEM_PRIVATE 624 38965000 ( 905.395 Mb) 90.62% 22.10%
MEM_IMAGE 1027 4ec3000 ( 78.762 Mb) 7.88% 1.92%
MEM_MAPPED 60 ef7000 ( 14.965 Mb) 1.50% 0.37%
Here is heap of the 4 dumps are in sequential increase:
Dump 1
!dumpheap –stat
……
0x003831e8 3,629 2,654,932 System.Int32[]
0x0046e2f0 434 6,338,060 Free
0x185f0a24 448,611 17,944,440 System.Data.DataRow
0x0038209c 13,865 35,518,048 System.Object[]
0x79b925c8 5,479,112 268,660,188 System.String
Total 6,052,407 objects, Total size: 338,900,792
Dump 2
!dumpheap –stat
……
0x0046e2f0 90,793 15,267,208 Free
0x185f0a24 608,897 24,355,880 System.Data.DataRow
0x0038209c 13,275 69,234,784 System.Object[]
0x79b925c8 7,371,274 363,205,532 System.String
Total 8,251,568 objects, Total size: 491,312,512
Dump 3
!dumpheap –stat
……
0x185f0a24 610,055 24,402,200 System.Data.DataRow
0x0038209c 52,401 68,994,616 System.Object[]
0x0046e2f0 107,593 102,039,064 Free
0x79b925c8 7,438,960 369,084,336 System.String
Total 8,604,456 objects, Total size: 590,406,024
Dump 4
!dumpheap –stat
……
0x185f0a24 830,669 33,226,760 System.Data.DataRow
0x0046e2f0 150,005 76,677,968 Free
0x0038209c 19,840 82,482,152 System.Object[]
0x79b925c8 10,079,231 504,747,348 System.String
Total 11,250,161 objects, Total size: 714,697,608
So mainly the increase is in System.Data.DataRow. So if we dump data tables it is really very huge 558,340 records specially for a 32 bit application; a single 32-bit process doesn't have the memory to handle that (15 times)
!dumpdatatables
0x0a5c175c 0x0a5c19d8 0x0a5c1bac 0x0a5c145c 779 15
0x035734e8 0x03573764 0x03573938 0x035731e8 779 15
0x028cba2c 0x028cbca8 0x028cbe7c 0x027fddb0 21,700 15
0x05ff2db8 0x05ff3034 0x05ff3208 0x05ff23ec 246,611 15
0x069711ec 0x06971468 0x0697163c 0x069687b8 558,340 15
Total 115 DataTable objects
So, if you have big datatables, the only recourse is to change the design and not allow that. Forexample do SELECT TOP 1000 or something instead of SELECT *
Conclusion
==========
MEMORY ISSUE: 715 MB of strings Strings come from having HUGE datatables in memory
ACTION To Resolve:
===============
- Build 4 modules in release mode
- Change ASP .NET code to make sure that datatables can only reach reasonable size; it is not normal to show a grid on a web page that has 500,000 item.
https://blogs.msdn.com/b/tom/archive/2007/12/26/high-memory-continued.aspx