Experimental memory allocator with vendored mimalloc#29123
Experimental memory allocator with vendored mimalloc#29123tiran wants to merge 33 commits intopython:mainfrom
Conversation
3cadf5e to
f865363
Compare
e1cecad to
a4e7165
Compare
|
🤖 New build scheduled with the buildbot fleet by @tiran for commit a4e71652eaacf491eb682d99fdbb0a521b8cb33f 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
|
🤖 New build scheduled with the buildbot fleet by @tiran for commit b6f5965e657df821b2345433163293d5345d5bab 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
|
🤖 New build scheduled with the buildbot fleet by @tiran for commit 11efb79362b5f49e441d3a24da01f3740a2222d5 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
d3a1605 to
8d7373a
Compare
|
🤖 New build scheduled with the buildbot fleet by @tiran for commit 8d7373a0c3f1f47b1320087f8deafc7bd7c9ad4a 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
|
Saw your PR in microsoft/mimalloc#475. This is great. I'm using mimalloc as a drop-in replacement with the ENV variables: PYTHONMALLOC=malloc MIMALLOC_PAGE_RESET=0 MIMALLOC_LARGE_OS_PAGES=1 LD_PRELOAD='/usr/lib64/libmimalloc.so' I expected that this upstream integration would bring other benefits, but it would not be able to use mimalloc's allocation of large OS pages? |
|
🤖 New build scheduled with the buildbot fleet by @tiran for commit 8d7373a0c3f1f47b1320087f8deafc7bd7c9ad4a 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
ifeq is not portable. Original patch by Neil. Co-authored-by: Neil Schemenauer <nas@arctrix.com> Signed-off-by: Christian Heimes <christian@python.org>
See: microsoft/mimalloc#426 Signed-off-by: Christian Heimes <christian@python.org>
Use mimalloc's ``static.c`` to include mimalloc library into obmalloc. This allows us to prefix all symbols with ``_Py_`` prefix. Signed-off-by: Christian Heimes <christian@python.org>
|
This PR has been replaced by #31164. |
EXPERIMENTAL This is an experimental pull request and a proof of concept. mimalloc integration is in a very early stage.
Vendor and hook up mimalloc. The PR only replaces raw memory allocator and Python's internal obmalloc with mimalloc. It does not use any of the advanced features of mimalloc such as heaps.
--with-mimalloc=yesby default (for testing)--with-pymalloc=noby default--with-freelists=yesmimalloc requires C11
<stdatomic.h>on POSIX platforms to provide atomic operations such as CAS. GCC on RHEL 7 / CentOS 7 is too old. GCC 4.9 and clang 3.6 seem to be minimum versions. Users need install Red Hat Developer Toolset 10.0 from Software Collections. The CentOS 7-based manylinux2014 container image comes with GCC 10.2 pre-installed.related mimalloc tickets
Initial benchmarks
Initial benchmarks should be taken with a big grain of salt. It seems like mimalloc is in the same ballpark as libc malloc + obmalloc with slightly better performance in some cases. I haven't measured memory consumption yet.
with mimalloc, without pymalloc, without freelists
In general about same performance, with some benchmarks 7% faster to 12% slower, https://gist.github.com/pablogsal/33fce1cbe5f908c1d85cae5d678f50a6
with mimalloc, without pymalloc, with freelists
In general 2% speedup, with some benchmarks 9% faster to 6% slower, https://gist.github.com/pablogsal/8027937b71cd30f17aaaa5ef7c885d3e
debug output