title: How to determine the memory of a c++ object at runtime
body: <p>I'm trying to determine the size of an object at runtime. sizeof doesn't work because this returns the size at compile time. Here is an example of what I mean:</p>
  
  <pre><code>class Foo 
  {
  public:
      Foo() 
      {
          c = new char[1024*1024*1024];
      }
      ~Foo() 
      { 
          delete[] c; 
      }
  
  private:
      char *c;
  };
  </code></pre>
  
  <p>In this case, <code>sizeof(Foo)</code> will be 4 bytes and not ~1GB. How can I determine the size of Foo at runtime? Thanks in advance.</p>