title: How many bytes uses stack with N items?
body: <p>I would like to analyze space performance and I have the following code:</p>
  
  <pre><code>public class ListStack&lt;T&gt; : IStack&lt;T&gt;
  {
      private class Node
      {
          public Node next;
          public T value;
      }
      private string[] arr;
      private Node last;
      private int size;
      ....
  }
  </code></pre>
  
  <p>How much space does it use?</p>
  
  <p>I know that in Java this code will have:</p>
  
  <p><code>16 bytes</code> (object overhead)</p>
  
  <p><code>8 bytes</code> (inner class extra overhead)</p>
  
  <p><code>8 bytes</code> (reference to String)</p>
  
  <p><code>8 bytes</code> (reference to Node)</p>
  
  <p><code>8 bytes</code> (reference to array)</p>
  
  <p><code>24 bytes</code>(array overhead)</p>
  
  <p>...</p>
  
  <p>But what about C# (including padding, array overhead, etc.)? C# use the same amount of space like Java? If not, what the difference between them?</p>