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 brian.curtin, loewis, neologix, pitrou, tim.golden, vstinner
Date 2013-05-31.23:29:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I tested VirtualAlloc/VirtualFree versus malloc/free on Windows 7 SP1 64-bit. On my small test, when using VirtualAlloc/VirtualFree, the memory peak is lower (ex: 58.1 MB vs 59.0), and the memory usage is the same or sometimes lower. The difference is small, malloc() implementation on Windows 7 is efficient! But I am in favor of using VirtualAlloc/VirtualFree because it is the native API and the gain may be bigger on a real application.


I used the following script for my test:

I reused get_process_mem_info() code from psutil to get current and peak memory usage (I failed to install psutil, I don't understand why).

I also replace func() of my script with to create many tuples.


Python < 3.3 wastes a lot of memory with Python 3.3 behaves much better thanks to the usage of mmap() on Linux, and the fixed threshold on 64-bit (min=512 bytes, instead of 256).
Date User Action Args
2013-05-31 23:29:07vstinnersetrecipients: + vstinner, loewis, pitrou, tim.golden, brian.curtin, neologix
2013-05-31 23:29:07vstinnersetmessageid: <>
2013-05-31 23:29:07vstinnerlinkissue13483 messages
2013-05-31 23:29:06vstinnercreate