C#vb:System.Func需要多少内存? [英] C# vb: System.Func takes how much memory?
本文介绍了C#vb:System.Func需要多少内存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
确切地说,System.Func有多少内存?
如果System.Func是1行或1000行,有没有区别?
$ Func<>是委托类型,一个实例在x86 jitter中占用32个字节的存储空间:$ b $ b
- 8个字节用于对象头
- 4个字节用于Delegate._methodBase字段
- 4个字节为Delegate._methodPtr字段
- 4个字节用于Delegate._methodPtrAux字段
- 4个字节用于Delegate._target字段
- 4个字节用于MulticastDelegate._invocationCount字段
- MulticastDelegate._invocationList字段的4字节
- 4个字节为Delegate._methodPtr字段
目标方法大小不相关,委托对象只存储方法的地址。
exactly how much memory does a System.Func holds?
Is there any difference if the System.Func is 1 line or 1000 lines?
解决方案
Func<> is a delegate type, an instance takes 32 bytes of storage in the x86 jitter:
- 8 bytes for the object header
- 4 bytes for the Delegate._methodBase field
- 4 bytes for the Delegate._methodPtr field
- 4 bytes for the Delegate._methodPtrAux field
- 4 bytes for the Delegate._target field
- 4 bytes for the MulticastDelegate._invocationCount field
- 4 bytes for the MulticastDelegate._invocationList field
The target method size is not relevant, the delegate object only stores the address of the method.
这篇关于C#vb:System.Func需要多少内存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文