深入解密.NET(GC記憶體回收)

來源:互聯網
上載者:User

標籤:結構   nullable   bsp   int   記憶體回收   system.in   char   alt   類型   

實值型別與參考型別

實值型別(Value Type),實值型別執行個體通常分配線上程的堆棧(stack)上,並且不包含任何指向執行個體資料的指標,因為變數本身就包含了其執行個體資料

C#的所有實值型別均隱式派生自System.ValueType:

結構體:struct(直接派生於System.ValueType),使用者定義的結構體(派生於System.ValueType);

整 型:sbyte(System.SByte的別名),short(System.Int16),int(System.Int32),long (System.Int64),byte(System.Byte),ushort(System.UInt16),uint (System.UInt32),ulong(System.UInt64),char(System.Char);

浮點型:float(System.Single),double(System.Double); 用於財務計算的高精度decimal型:decimal(System.Decimal)。

bool型:bool(System.Boolean的別名);

 枚舉:enum(派生於System.Enum);

可空類型、派生於System.Nullable<T>泛型結構體,T?實際上是System.Nullable<T>的別名。

參考型別

C#有以下一些參考型別:

數組(派生於System.Array)

類:class(派生於System.Object);

介面:interface;

委託:delegate(派生於System.Delegate)。

object(System.Object);

字串:string(System.String)。 

記憶體配置圖(stack、Heap):

託管堆是基於進程的。

 

GC

 

深入解密.NET(GC記憶體回收)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.