I have some custom types (the type cannot be serialized, so I cannot use BinaryFormatter
and MemoryStream
to get the bytes needed to hols this object) and I cannot use Marshal.SizeOf()
. Is there other way to get the memory needed by a object? The object can be an instance of a custom type or an array of a custom type objects.
PS: It's not accurate to get the memory at the begining and at the end to obtain the memory needed because other processes runs in the background