Bri*_*per 8 vb.net memory profiling
我正在使用Visual Studio性能工具试图发现我的程序内存不足的原因.在猜测该做什么后,我制作了这个显示: -
这似乎在这里建议对象的大小仅包括对象,并且包含大小包括对象引用的所有对象.但有关的对象是这样定义的: -
Public Structure Temperature
Implements IMeasurements, IComparable(Of Temperature)
Private Const KELVIN_TO_CENTIGRADE As Double = 273.15
Private temperature As Double
Friend Sub New(ByVal passed_temperature As Double)
temperature = passed_temperature
End Sub
' some other methods, operator overloads and the IComparable
' implementation
End Structure
Run Code Online (Sandbox Code Playgroud)
因此,尺寸显然并不意味着除非与这些结构相关的浪费空间数量惊人.
那么,有谁知道这是怎么回事?我完全忽略了这一点吗?
根据我的实验,大小和包含大小是在Visual Studio工具提示上写的:
内存中对象的总大小
和
对象的总大小加上所有子对象的总大小
但对我来说,最重要的事情是:
总大小是对象的可见大小+开销.这意味着以下类在x64上占用24个字节.
class X {}
Run Code Online (Sandbox Code Playgroud)包含大小不会处理值类型的子项.这意味着如果您的类具有值类型的子类型,则不会计算从后者引用的对象.
| 归档时间: |
|
| 查看次数: |
4564 次 |
| 最近记录: |