mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
gh-90815: Add mimalloc memory allocator (#109914)
* Add mimalloc v2.12 Modified src/alloc.c to remove include of alloc-override.c and not compile new handler. Did not include the following files: - include/mimalloc-new-delete.h - include/mimalloc-override.h - src/alloc-override-osx.c - src/alloc-override.c - src/static.c - src/region.c mimalloc is thread safe and shares a single heap across all runtimes, therefore finalization and getting global allocated blocks across all runtimes is different. * mimalloc: minimal changes for use in Python: - remove debug spam for freeing large allocations - use same bytes (0xDD) for freed allocations in CPython and mimalloc This is important for the test_capi debug memory tests * Don't export mimalloc symbol in libpython. * Enable mimalloc as Python allocator option. * Add mimalloc MIT license. * Log mimalloc in Lib/test/pythoninfo.py. * Document new mimalloc support. * Use macro defs for exports as done in: https://github.com/python/cpython/pull/31164/ Co-authored-by: Sam Gross <colesbury@gmail.com> Co-authored-by: Christian Heimes <christian@python.org> Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
4ebf2fae96
commit
05f2f0ac92
61 changed files with 16792 additions and 161 deletions
|
@ -803,6 +803,7 @@ class CmdLineTest(unittest.TestCase):
|
|||
def test_pythonmalloc(self):
|
||||
# Test the PYTHONMALLOC environment variable
|
||||
pymalloc = support.with_pymalloc()
|
||||
mimalloc = support.with_mimalloc()
|
||||
if pymalloc:
|
||||
default_name = 'pymalloc_debug' if support.Py_DEBUG else 'pymalloc'
|
||||
default_name_debug = 'pymalloc_debug'
|
||||
|
@ -821,6 +822,11 @@ class CmdLineTest(unittest.TestCase):
|
|||
('pymalloc', 'pymalloc'),
|
||||
('pymalloc_debug', 'pymalloc_debug'),
|
||||
))
|
||||
if mimalloc:
|
||||
tests.extend((
|
||||
('mimalloc', 'mimalloc'),
|
||||
('mimalloc_debug', 'mimalloc_debug'),
|
||||
))
|
||||
|
||||
for env_var, name in tests:
|
||||
with self.subTest(env_var=env_var, name=name):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue