











GC.Collect();
1 在统信终端安装并使用 .NET 诊断工具:
# 安装诊断工具
dotnet tool install --global dotnet-dump
dotnet tool install --global dotnet-gcdump
离线安装
dotnet tool install --global --add-source /home/Feng/ --ignore-failed-sources dotnet-dump
# 找到你的 Avalonia 进程 PID
ps -ef | grep YourApp
# 在内存增长到较大时,抓取内存快照 (.gcdump)
dotnet-gcdump collect -p <PID> -o leak_snapshot.gcdump
2 将生成的 .gcdump 文件复制到 Windows 开发机,用 Visual Studio 或 JetBrains dotMemory 打开,查看占用内存最多且实例数不断增加的对象。
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。