为何TimerThread中的Int64[]数组占用内存过大?
排查32位进程OutOfMemoryException问题
我正在排查32位进程中的OutOfMemoryException问题,统计数据里占用内存较大的System.Int64[]数组引起了我的注意:
堆内存统计信息
!dumpheap -stat ........ 707b251c 3 692500 System.Int64[] 6fa6b038 72151 2020228 System.Diagnostics.ProcessModule 6fa9b1a0 72151 2308832 System.Diagnostics.ModuleInfo 707fdd04 2404 3223807 System.Byte[] 707faea4 11990 5780152 System.Object[] 707fb37c 9847 16162530 System.Char[] 00c16a88 41026 19281740 Free 707fac04 183726 21698276 System.String Total 758006 objects
定位大尺寸System.Int64[]实例
0:000> !DumpHeap /d -mt 707b251c Address MT Size 02f5b9ec 707b251c 76 02f7c198 707b251c 60 03f40000 707b251c 692364 Statistics: MT Count TotalSize Class Name 707b251c 3 692500 System.Int64[] Total 3 objects
GC根引用追踪结果
0:000> !gcroot 03f40000 Thread 4320: *** WARNING: Unable to verify checksum for System.ni.dll 1238ea6c 6fbedbd0 System.Net.TimerThread.ThreadProc() [f:\dd\NDP\fx\src\net\System\Net\_TimerThread.cs @ 707] edi: (interior) -> 03dc3670 System.Object[] -> 03f40000 System.Int64[] Found 1 unique roots (run '!GCRoot -all' to see all roots).
当前使用的是.NET Framework 4.8,想请教:TimerThread为何需要如此大的数组?
补充说明:上述转储来自简化版应用,初始版本的内存问题更为严重——线程数达229(简化版为32),应用域数量约180(简化版为0),对应的堆统计数据如下:
!dumpheap -stat .......... 707b251c 387 105384412 System.Int64[]
内容的提问来源于stack exchange,提问作者user3791838
相关产品推荐
相关产品推荐

