0

The class is not serializable. I made a test console app where it ONLY added 10^7 new GeoCoordinates(1,1) to a List, and the resulting memory usage of the app was 735 MB in windows.

I guess the number of bytes is 72 bytes?

Markus
  • 1,020
  • 14
  • 18
  • 1
    Apparently, for your runtime, bitness and phase of the moon, it is. These things [vary for managed objects](https://blogs.msdn.microsoft.com/cbrumme/2003/04/15/size-of-a-managed-object/), so measuring effective memory usage *is* the appropriate way. – Jeroen Mostert Oct 10 '17 at 14:06
  • Take a look at [Hans Passant's answer](https://stackoverflow.com/a/3362736) to [How do I check the number of bytes consumed by a structure?](https://stackoverflow.com/q/3361986), and also look at [this answer](https://stackoverflow.com/a/28514434) to [What is the size of a boolean In C#? Does it really take 4-bytes?](https://stackoverflow.com/q/28514373). Basically the size of a structure is intentionally obscured, but measuring the size of a large array of them might be the most accurate approximation. – dbc Oct 10 '17 at 14:10
  • @dbc The problem is that it is a class, not a struct. – Patrick Hofman Oct 10 '17 at 14:10
  • @PatrickHofman - Ah thank you. That makes it even less well defined then. – dbc Oct 10 '17 at 14:12
  • Indeed, hence the duplicate @dbc – Patrick Hofman Oct 10 '17 at 14:12

0 Answers0