>值类型是否有一个存储在CLR堆中的相关System.Type对象?
>如果没有关联的类型对象,则存储值类型静态字段和方法?
>值类型是否具有同步根字段(如果没有同步根块,则值类型是否是线程安全的)?
解决方法
Do value types have a related type-object stored in CLR heap?
不,没有.结构没有与之关联的标题,并且没有类型信息与其一起存储.如果询问System.Type,是类型元数据将在堆中.但它不会预先创建.
Where value type static fields are stored if there is no associated
type object in thread stacks?
无论ValueType或ReferenceType如何,静态字段都存储在名为“High Frequency Heap”的特殊堆中,每个AppDomain都有一个.与“Garbage Collected Heap”不同,此堆不是垃圾回收.
Every static variable is stored on the heap,regardless of whether
it’s declared within a reference type or a value type. There is only
one slot in total no matter how many instances are created. (There
don’t need to be any instances created for that one slot to exist
though.) Note that this heap is separate from the normal garbage
collected heap – it’s kNown as a “high frequency heap”,and there’s
one per application domain.
Do value types have sync root field (are value types thread safe if there is no sync root for them)?
不知道你在这里问什么.如果你的意思是SyncBlock而不是Sync-Root,它与线程安全无关.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。