[issue13483] Use VirtualAlloc to allocate memory arenas
Martin v. Löwis
report at bugs.python.org
Tue Nov 29 21:48:33 CET 2011
Martin v. Löwis <martin at v.loewis.de> added the comment:
The patch looks good to me.
To study Microsoft's malloc, see VC\crt\src\malloc.c. Typically, it uses HeapAlloc from the CRT heap, unless it's in 32-bit mode, and __active_heap is either __V6_HEAP or __V5_HEAP. This is determined at startup by __heap_select, inspecting an environment variable __MSVCRT_HEAP_SELECT. If that's not set, the CRT heap is used.
The CRT heap, in turn, is created with HeapCreate (no flags).
As an alternative approach, Python could consider completely dropping obmalloc on Windows, and using a Windows Low Fragementation Heap (LFH) instead, with HEAP_NO_SERIALIZE (as the heap would be protected by the GIL).
If we take the route proposed by this patch, I recommend also dropping all other CRT malloc() calls in Python, and make allocations from the process heap instead (that's a separate issue, though).
----------
nosy: +loewis
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13483>
_______________________________________
More information about the Python-bugs-list
mailing list