M
mk
Obviously, don't try this on low-memory machine:
.... a='spam'*10
....
....10000000
Hm, apparently Python didn't spot that 'spam'*10 in a's values is really
the same string, right?
So sys.getsizeof returns some 200MB for this dictionary. But according
to top RSS of the python process is 300MB. ps auxw says the same thing
(more or less).
Why the 50% overhead? (and I would swear that a couple of times RSS
according to top grew to 800MB).
Regards,
mk
.... a='spam'*10
....
.... ids[id(a)]=True3085713568L>>> import sys
>>> sys.getsizeof(a) 201326728
>>> id(a[1]) 3085643936L
>>> id(a[100])
....10000000
Hm, apparently Python didn't spot that 'spam'*10 in a's values is really
the same string, right?
So sys.getsizeof returns some 200MB for this dictionary. But according
to top RSS of the python process is 300MB. ps auxw says the same thing
(more or less).
Why the 50% overhead? (and I would swear that a couple of times RSS
according to top grew to 800MB).
Regards,
mk