static int SizeOfObjectInBytes(CachedSnapshot snapshot, int iTypeDescription, BytesAndOffset byteOffset, CachedSnapshot.ManagedMemorySectionEntriesCache heap) { if (iTypeDescription < 0) { return(0); } if (snapshot.typeDescriptions.HasFlag(iTypeDescription, TypeFlags.kArray)) { return(ArrayTools.ReadArrayObjectSizeInBytes(snapshot, byteOffset, iTypeDescription)); } if (snapshot.typeDescriptions.typeDescriptionName[iTypeDescription] == "System.String") { return(StringTools.ReadStringObjectSizeInBytes(byteOffset, snapshot.virtualMachineInformation)); } //array and string are the only types that are special, all other types just have one size, which is stored in the type description return(snapshot.typeDescriptions.size[iTypeDescription]); }