c# - How to calculate size of Nullable<T> datatypes -
this question has answer here:
- what memory footprint of nullable<t> 5 answers
actually, willing know how memory being consumed following datatypes
int? = memory size?
double? = memory size?
bool? = memory size?
can give me information storage or method calculate size
do want know memmory consumption of e.g. int? x
? msdn says:
... common language runtime assigns storage based on characteristics of platform on application executing. in circumstances packs declared elements closely possible; in other cases aligns memory addresses natural hardware boundaries. also, storage assignment different on 64-bit platform on 32-bit platform.
the same considerations apply each member of composite data type such structure or array. furthermore, composite types have additional memory requirements. example, array uses memory array , each dimension. on 32-bit platform, overhead 12 bytes plus 8 bytes each dimension. on 64-bit platform requirement doubled. cannot rely on adding nominal storage allocations of components.
an object referring elementary or composite data type uses 4 bytes in addition data contained in data type.