>> On a 64-bit machine, that's 16 bytes for PyObject_HEAD and 8 more >> bytes for the value, 24 bytes total. Changing long to int won't >> decrease the struct size to 20 because the compiler will pad it to >> 24, the nearest multiple of 8. (Forcing the compiler to pack the >> struct won't help because malloc will still pad it for you.) > > That's an excellent point. And true, too. Thanks, that will lay the > issue to rest.
As a side observation, notice how the increase in memory consumption does not primarily originate from the increase in the size of a long. Instead, all pointers double their sizes. In an OO language (like Python), you have lots of pointers, so you will often find that the application uses more memory when run in 64-bit mode. If that is a concern to you, let me rephrase Terry's observation: just try running a 32-bit Python interpreter on your 64-bit system, and you may find that it actually runs better because it uses less memory. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list