mirror of
https://github.com/python/cpython.git
synced 2024-11-28 16:45:42 +01:00
05f2f0ac92
* 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>
25 lines
867 B
C
25 lines
867 B
C
/* ----------------------------------------------------------------------------
|
|
Copyright (c) 2018-2023, Microsoft Research, Daan Leijen
|
|
This is free software; you can redistribute it and/or modify it under the
|
|
terms of the MIT license. A copy of the license can be found in the file
|
|
"LICENSE" at the root of this distribution.
|
|
-----------------------------------------------------------------------------*/
|
|
|
|
// Select the implementation of the primitives
|
|
// depending on the OS.
|
|
|
|
#if defined(_WIN32)
|
|
#include "windows/prim.c" // VirtualAlloc (Windows)
|
|
|
|
#elif defined(__APPLE__)
|
|
#include "osx/prim.c" // macOSX (actually defers to mmap in unix/prim.c)
|
|
|
|
#elif defined(__wasi__)
|
|
#define MI_USE_SBRK
|
|
#include "wasi/prim.c" // memory-grow or sbrk (Wasm)
|
|
|
|
#else
|
|
#include "unix/prim.c" // mmap() (Linux, macOSX, BSD, Illumnos, Haiku, DragonFly, etc.)
|
|
|
|
#endif
|