Skip to content
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

gh-115103: Enable internal mimalloc assertions in debug builds #116343

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion Include/internal/pycore_mimalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ typedef enum {
# define MI_DEBUG_FREED PYMEM_DEADBYTE
# define MI_DEBUG_PADDING PYMEM_FORBIDDENBYTE
#ifdef Py_DEBUG
# define MI_DEBUG 1
# define MI_DEBUG 2
#else
# define MI_DEBUG 0
#endif
Expand Down
3 changes: 3 additions & 0 deletions Objects/mimalloc/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,10 @@ bool _mi_free_delayed_block(mi_block_t* block) {
// get segment and page
const mi_segment_t* const segment = _mi_ptr_segment(block);
mi_assert_internal(_mi_ptr_cookie(segment) == segment->cookie);
#ifndef Py_GIL_DISABLED
// The GC traverses heaps of other threads, which can trigger this assert.
mi_assert_internal(_mi_thread_id() == segment->thread_id);
#endif
mi_page_t* const page = _mi_segment_page_of(segment, block);

// Clear the no-delayed flag so delayed freeing is used again for this page.
Expand Down
Loading