确定多少内存类使用? [英] Determine how much memory a class uses?

查看:151
本文介绍了确定多少内存类使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想找到一种方法来确定在运行时有多少内存给定的类是在.NET中使用。使用Marshal.SizeOf()已经出来了,因为它只能在值类型。有没有一种方法来检查到底有多少内存类使用?

I am trying to find a way to determine at run-time how much memory a given class is using in .NET. Using Marshal.SizeOf() is out, as it only works on value types. Is there a way to check exactly how much memory a class uses?

推荐答案

我是最近才开始关注到这种类型的事情,但我发现,内存分析器可以提供关于你的应用程序中的对象实例非常详细的信息。

I've only recently started looking into this type of thing, but i have found that memory profilers can give quite detailed information regarding instances of objects within your application.

下面是一对夫妇,是值得尝试:

Here are a couple that are worth trying:

  • ANTS Profiler
  • .NET Memory Profiler

这篇关于确定多少内存类使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆