C++ virtual function table memory cost

The v-table is per class and not per object. Each object contains just a pointer to its v-table. So the overhead per instance is sizeof(pointer) (usually 4 or 8 bytes). It doesn’t matter how many virtual functions you have for the sizeof the class object. Considering this, I think you shouldn’t worry too much about it.

Leave a Comment