title: What kind of an impact do stateless objects with a ton of functions have on memory?
body: <p>Let's assume that I have a class named <code>Foo</code>. The class has no state of its own but has a ton of functions.</p>
  
  <pre><code>class Foo
  {
    public void One()
    {
      // 500 lines of code
      var bigObject = new BigBigBigObject();
  
      // do something to the big object
  
      // launch long-running operation
  
      // do some COM interop
    }
  
    public Result Two()
    {
      // 2800 lines
      using(var disposable = new SomeCustomDisposable())
      {
        ...
      }
    }
  
    public async Task&lt;Bar&gt; FourteenHundredAndFifty()
    {
      ...
    }
  }
  </code></pre>
  
  <p>And in the main method, we have a reference to <code>Foo</code> like so:</p>
  
  <pre><code>public class Program
  {
    public static void Main(string[] args)
    {
      var foo = new Foo();
  
      // run the program for a long time
      // calling functions on Foo
  
      ....
    }
  }
  </code></pre>
  
  <p>My question is: even though a reference to <code>Foo</code> is kept alive throughout the life of the program, since <code>Foo</code> doesn't have state of its own, what impact does it have on the memory footprint of the application?</p>
  
  <p>I would assume that since it has no state, its size would still be 12 bytes (on a 32-bit machine and 24 bytes on a 64-bit machine) on the GC heap.</p>
  
  <p>However:</p>
  
  <ol>
  <li><p>It might have a lot of bytes occupied on the loader heap since it has many methods and so their method definitions will be occupying a considerable amount of memory.</p></li>
  <li><p>Even though it has no state of its own, when one or more of its functions are called, they leave large objects on the large object heap. Even then, what those methods do to the GC heap and whether or not they leave large objects for a long time and whether or not they cause too many allocations or GC's are all dependent on the code in those functions. The size of <code>Foo</code> is still small and the fact that the reference to <code>Foo</code> is kept alive throughout the program has no bearing on the GC heap.</p></li>
  </ol>
  
  <p>Are my assumptions correct?</p>