zoukankan      html  css  js  c++  java
  • 深入解密.NET(GC垃圾回收)

    值类型与引用类型

    值类型(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

  • 相关阅读:
    linux随记
    springboot-2
    netty-lean1
    nginx
    自定义启动器
    arrayList add
    Mybatis 转义符
    idea 闪退 但是启动的服务还在解决办法
    java 通过map根据list某个字段进行合并
    java list的深拷贝
  • 原文地址:https://www.cnblogs.com/xmai/p/6795140.html
Copyright © 2011-2022 走看看