memory usage

Duncan Booth duncan at NOSPAMrcp.co.uk
Wed May 7 09:01:17 EDT 2003


Duncan Booth <duncan at NOSPAMrcp.co.uk> wrote in
news:Xns937482FE69A32duncanrcpcouk at 127.0.0.1: 

> If the compiler decided to pad all the structures an empty dictionary 
> occupies 160 bytes, even though only 124 of them are used. In your
> case the padding alone would lose you 21Mb. So far as I can see the
> windows version of Python has this padding, I don't know about other
> implementations. It might be interesting to see whether removing the
> padding gave a net benefit or hit on performance.

Actually it seems that windows isn't inserting any padding, so its only 124 
bytes overhead. I must have misunderstood the bit about default structure 
member alignment being 8 bytes.

-- 
Duncan Booth                                             duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?




More information about the Python-list mailing list