title: In C#, how much memory does a struct require?
body: <p>I will be working with approximately 320,000,000 data points for a high-resolution waveform.  Each data point will require 2 floats (XY coordinate) for a total of 8 bytes.</p>
  
  <p>In order to have this memory allocated all at once, I was planning on using a <code>struct</code> such as the following:</p>
  
  <pre><code>public struct Point
  {
      public float X; //4-bytes
      public float Y; //4-bytes.
  }
  </code></pre>
  
  <p>Since a struct is a value type, I am assuming that it consumes only the amount of memory necessary for each variable, as well as <strong>some small, fixed amount</strong> used by the CLR (Common Language Runtime).</p>
  
  <p>Is there a way I can compute how much memory a struct will use during runtime of my application?  That is, granted I know the following:</p>
  
  <ul>
  <li>How many variables are in the struct.</li>
  <li>How many bytes are used for each variable.</li>
  <li>How many instances of the struct will be alive at a given point in time.</li>
  </ul>