c# - 如何证明某个版本的程序内存效率更高?

标签 c# .net performance memory-management

我有一个必须处理数十万条记录的应用程序。现在,我一次只能处理其中的 500 个。每批处理/分析最多可能需要 5 分钟(总共约 10 小时的处理时间)。限制 500 条记录的原因是内存消耗。我认为我们的程序占用这么多内存的主要原因之一是我们没有设置列表或字典的大小(例如,new List() 而不是 new List(100000))。我进行了更改以设置集合的大小,以便 .NET 停止创建和复制具有额外容量的新列表。

这是我的问题:如何证明一个程序版本的内存效率更高?我应该查看性能计数器吗?工具?监控?

最佳答案

有类似 .net memory profiler 的工具您可以从中深入分析 .net 应用程序的内存管理和内存泄漏。

.NET Memory Profiler is a powerful tool for finding memory leaks and optimizing the memory usage in programs written in C#, VB.NET or any other .NET Language. With the help of the profiling guides, the automatic memory analyzer, and specialized trackers, you can make sure that your program has no memory or resource leaks, and that the memory usage is as optimal as possible.

关于c# - 如何证明某个版本的程序内存效率更高?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11372153/

相关文章:

c# - 我如何在 C# 中反序列化 python pickles?

c# - 如何从托管代码中调试未发布的 COM 引用?

c# - WPF ComboBox 中带有列的不可选择的标题

c# - 元数据异常 : Unable to load the specified metadata resource

c# - 在与 Ninject 绑定(bind)时使用通用类型——这可能吗?

MySQL 与 MongoDB 1000 次读取

c# - foreach 中的 Linq 优化

.net - iPhone/Android/WP7 应用程序?

ios - 有没有更有效的方法来做到这一点?

java - 集成显卡上的 Java2D 绘图速度缓慢