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 vstinner
Recipients josh.r, jtaylor, neologix, njs, pitrou, skrah, vstinner
Date 2014-04-28.09:15:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1398676506.19.0.732457019341.issue21233@psf.upfronthosting.co.za>
In-reply-to
Content
Demo of calloc-5.patch on Linux. Thanks to calloc(), bytes(50 * 1024 * 1024) doesn't allocate memory for null bytes and so the RSS memory is unchanged (+148 kB, not +50 MB), but tracemalloc says that 50 MB were allocated.

$ ./python -X tracemalloc
Python 3.5.0a0 (default:4b97092aa4bd+, Apr 28 2014, 10:40:53) 
[GCC 4.8.2 20131212 (Red Hat 4.8.2-7)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os, tracemalloc
>>> os.system("grep RSS /proc/%s/status" % os.getpid())
VmRSS:	   10736 kB
0
>>> before = tracemalloc.get_traced_memory()[0]
>>> large = bytes(50 * 1024 * 1024)
>>> import sys
>>> sys.getsizeof(large) / 1024.
51200.0478515625
>>> (tracemalloc.get_traced_memory()[0] - before) / 1024.
51198.1962890625
>>> os.system("grep RSS /proc/%s/status" % os.getpid())
VmRSS:	   10884 kB
0
History
Date User Action Args
2014-04-28 09:15:06vstinnersetrecipients: + vstinner, pitrou, njs, skrah, neologix, jtaylor, josh.r
2014-04-28 09:15:06vstinnersetmessageid: <1398676506.19.0.732457019341.issue21233@psf.upfronthosting.co.za>
2014-04-28 09:15:06vstinnerlinkissue21233 messages
2014-04-28 09:15:05vstinnercreate