gpt4 book ai didi

vb.net - 性能和诊断显示中的大小和包含大小是什么意思?

转载 作者:IT王子 更新时间:2023-10-28 23:35:36 26 4
gpt4 key购买 nike

我正在使用 Visual Studio 性能工具试图找出我的程序内存不足的原因。在猜到该怎么做之后,我制作了这个显示:-

enter image description here

好像提示here对象的大小仅包括对象,包含的大小包括对象引用的所有对象。但是相关的对象是这样定义的:-

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

因此,尺寸显然并不意味着,除非与这些结构相关的浪费空间数量惊人。

那么,有人知道这是怎么回事吗?我完全错过了这里的重点吗?

最佳答案

根据我的实验 SizeInclusive size 是写在 Visual Studio 工具提示上的:

Total size of the objects in memory

Total size of the objects plus total size of all child objects

但对我来说最重要的事情是:

  1. 总大小是对象的可见大小+开销。这意味着以下类在 x64 上占用 24 个字节。

    class X {} 
  2. 包含大小不处理值类型的子级。这意味着如果您的类具有值类型的子类,则不会计算从后者引用的对象。

关于vb.net - 性能和诊断显示中的大小和包含大小是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32653213/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com