Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gh-90815: Add mimalloc memory allocator #31164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 19 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Really force off MI_DEBUG in release builds
  • Loading branch information
tiran committed Aug 30, 2022
commit 0367c822de80e8992dc4f9155e2945f9b1f368ba
23 changes: 16 additions & 7 deletions Include/internal/pycore_mimalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
#define MI_DEBUG_FREED PYMEM_DEADBYTE
#define MI_DEBUG_PADDING PYMEM_FORBIDDENBYTE

/* ASAN builds don't use MI_DEBUG. ASAN + MI_DEBUG triggers additional
* checks, which can cause mimalloc to print warnings to stderr. The
* warnings break some tests.
/* ASAN builds don't use MI_DEBUG.
*
* ASAN + MI_DEBUG triggers additional checks, which can cause mimalloc
* to print warnings to stderr. The warnings break some tests.
*
* mi_usable_size: pointer might not point to a valid heap region:
* ...
Expand All @@ -30,18 +31,26 @@
# define MI_DEBUG 0
#endif

/* Perform additional checks in debug builds, see mimalloc-types.h
#ifdef Py_DEBUG
/* Debug: Perform additional checks in debug builds, see mimalloc-types.h
* - enable basic and internal assertion checks with MI_DEBUG 2
* - check for double free, invalid pointer free
* - use guard pages to check for buffer overflows
*/
#ifdef Py_DEBUG
# ifndef MI_DEBUG
# define MI_DEBUG 2
# endif
# define MI_SECURE 4
#elif defined(PY_MIMALLOC_SECURE)
# define MI_SECURE PY_MIMALLOC_SECURE
#else
// Production: no debug checks, secure depends on --enable-mimalloc-secure
# ifndef MI_DEBUG
# define MI_DEBUG 0
# endif
# if defined(PY_MIMALLOC_SECURE)
# define MI_SECURE PY_MIMALLOC_SECURE
# else
# define MI_SECURE 0
# endif
#endif

/* Prefix all non-static symbols with "_Py_"
Expand Down