You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

为何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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.05 22:12:40