Message190427
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:
https://bitbucket.org/haypo/misc/raw/98eb42a3ed2144141d62c75e3d07933839fe2a0c/python/python_memleak.py
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 tuples.py to create many tuples.
--
Python < 3.3 wastes a lot of memory with python_memleak.py. 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:07 | vstinner | set | recipients:
+ vstinner, loewis, pitrou, tim.golden, brian.curtin, neologix |
2013-05-31 23:29:07 | vstinner | set | messageid: <1370042947.15.0.143515716751.issue13483@psf.upfronthosting.co.za> |
2013-05-31 23:29:07 | vstinner | link | issue13483 messages |
2013-05-31 23:29:06 | vstinner | create | |
|