是否可以分析单元测试的内存使用情况?

发布于 2024-09-03 04:44:30 字数 231 浏览 3 评论 0原文

我正在考虑使用 Visual Studio 附带的单元测试框架构建一些单元测试来确定资源是否泄漏(或没有)。

目前,我正在评估最新版本的 ANTS Profiler,但我不太清楚它是否允许我强制从代码中生成快照(这样我就可以拍摄快照,运行单元测试几百次,强制进行垃圾收集,并拍摄另一个快照,并将结果保存起来以供以后分析)。

这是否可以与 ANTS/Visual Studio 相关,还是我应该使用其他分析器探索选项?

I'm looking at building some unit tests to ascertain if resources are leaking (or not) using the unit testing framework that comes with Visual Studio.

At present, I'm evaluating the latest version of ANTS Profiler, but I can't quite work out if it allows me to force a snapshot from code (so that I can take a snapshot, run a unit test a few hundred times, force a garbage collection, and take another snapshot, and save the results out for later analysis).

Is this possible to do with ANTS/Visual Studio or should I be exploring options with other profilers?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

長街聽風 2024-09-10 04:44:31

您看过 JetBrains 的 dotmemory 吗?

dotMemory Unit 是一个单元测试框架,允许您编写测试
检查您的代码是否存在各种内存问题。

例如:

当您需要简单地评估分配的内存量时
测试时,可以使用 AssertTraffic 属性。这个灵活的属性
允许您按对象类型、接口或过滤流量数据
命名空间。

Have you seen dotmemory from JetBrains?

dotMemory Unit is a unit testing framework which allows you to write tests
that check your code for all kinds of memory issues.

For example:

When you need to simply evaluate the amount of memory allocated in a
test, you can use the AssertTraffic attribute. This flexible attribute
allows you to filter traffic data by object type, interface, or
namespace.

稚气少女 2024-09-10 04:44:31

JetBrains dotTrace/dotMemory 和 ReSharper 在单元测试和分析方面有更好的集成。

http://www.jetbrains.com/profiler/index.html

不确定是否ANTS有这样的集成,不过你可以咨询一下红门售前吧?

http://www.red-gate.com/about/all_testimonials.htm

他们确实希望您致电他们以获取更多信息。

JetBrains dotTrace/dotMemory and ReSharper have better integration on unit testing and profiling.

http://www.jetbrains.com/profiler/index.html

Not sure if ANTS has such integration, but you can consult Red Gate presales, right?

http://www.red-gate.com/about/all_testimonials.htm

They do expect you to call them for more information.

初吻给了烟 2024-09-10 04:44:31

我使用 ANTS 探查器,我发现最方便的是将探查器附加到正在运行的测试进程,这可能会有所不同,具体取决于您使用的测试框架。例如,我使用 Resharper,进程映像名称类似于:

JetBrains.ReSharper.TaskRunner.CLR...

I use ANTS profiler, and what I find most convenient is to attach the profiler to the running test process, that may be different depending on what testing framework you are using. For example, I use Resharper and the process image name is called something like:

JetBrains.ReSharper.TaskRunner.CLR...

哥,最终变帅啦 2024-09-10 04:44:31

对于未来的读者,值得一提的是,您可以使用 ANTS Memory Profiler 从代码中强制执行快照。您需要引用

RedGate.MemoryProfiler.Snapshot.dll

ANTS 安装目录中包含的 。然后,您可以通过调用

RedGate.MemoryProfiler.Snapshot.TakeSnapshot("Optional snapshot name")

来拍摄快照完整详情请参见此处

For future readers, worth mentioning that you can force snapshots from within your code with ANTS Memory Profiler. You need to reference

RedGate.MemoryProfiler.Snapshot.dll

which is included in the ANTS install directory. You can then take a snapshot by calling

RedGate.MemoryProfiler.Snapshot.TakeSnapshot("Optional snapshot name")

Full details here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文