愚蠢的问题,但在WinForms应用程序即时通讯目前正在研究,我想获得分配的字节/使用量的名单,LT; SomeObject]>
保存在内存中(用于统计目的)。这可能吗?我已搜查直通可能的选项,但显然没有 myList.GetTotalBytes()
方法。
Silly question, but in a winforms app Im currently working on, I would like to get the amount of bytes allocated/used by a List<[SomeObject]>
held in memory (for statistical purposes). Is this possible? I have searched thru the possible options, but there is obviously no myList.GetTotalBytes()
method.
我不知道在运行时提供获取对象的大小的可靠的编程方法,但也有一些选项开放给你:
I'm not sure the runtime provides a reliable programmatic method of getting an object's size, however there are some options open to you:
使用像CLR分析器系统工具 使用Marshal.SizeOf() (返回对象的非托管大小) 在一个近似序列化对象的二进制 use a tool like CLR Profiler use Marshal.SizeOf() (returns the unmanaged size of the object) serialize your object to binary for an approximation上一篇:如何以调整阿拉伯语'aarab'字?请参阅我的code阿拉伯语、我的、aarab、code
下一篇:集成的Visual Studio在线Git仓库到Android 1.0.2工作室在线、仓库、工作室、Studio