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:
class Foo 
{
public:
    Foo() 
    {
        c = new char[1024*1024*1024];
    }
    ~Foo() 
    { 
        delete[] c; 
    }
private:
    char *c;
};
In this case, sizeof(Foo) will be 4 bytes and not ~1GB. How can I determine the size of Foo at runtime? Thanks in advance.
 
     
     
     
    