homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Пётр.Дёмин
Recipients Пётр.Дёмин
Date 2013年10月13日.12:00:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1381665601.5.0.467418586985.issue19246@psf.upfronthosting.co.za>
In-reply-to
Content
Taken from http://stackoverflow.com/a/19287553/135079
When I consume all memory:
 Python 2.7 (r27:82525, Jul 4 2010, 09:01:59) [MSC v.1500 32 bit (Intel)] on win32
 Type "help", "copyright", "credits" or "license" for more information.
 >>> a = {}
 >>> for k in xrange(1000000): a['a' * k] = k
 ...
 Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 MemoryError
 >>> len(a)
 64036
If we'll take summary keys length:
 >>> log(sum(xrange(64036)), 2)
 30.93316861532543
we'll get near 32-bit integer overflow. After that done,
 >>> a = {}
will free all 2 Gb of allocated memory (as shown in Task Manager), but executing:
 >>> for k in xrange(1000000): a[k] = k
Will cause:
 MemoryError
And dictionary length something like:
 >>> len(a)
 87382
History
Date User Action Args
2013年10月13日 12:00:01Пётр.Дёминsetrecipients: + Пётр.Дёмин
2013年10月13日 12:00:01Пётр.Дёминsetmessageid: <1381665601.5.0.467418586985.issue19246@psf.upfronthosting.co.za>
2013年10月13日 12:00:01Пётр.Дёминlinkissue19246 messages
2013年10月13日 12:00:01Пётр.Дёминcreate

AltStyle によって変換されたページ (->オリジナル) /