I have a class that I will literally instantiate billions of. I did my best to put as little data as possible in it, and I got it down to 10 bytes when compiled for an x64 architecture: an unsigned short int
and a size_t
. When I mouse over sizeof(myclass)
(in VS), however, it reports 16 bytes. If I comment out either of the fields, the size of the class is what you'd expect, 10 bytes and 2 bytes respectively.
Is there a way to instruct the compiler to use only 10 bytes for my class?