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

Skip to content

Commit 399500e

Browse files
committed
disable verbose debug messages
1 parent 50cbff2 commit 399500e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Objects/obmalloc.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,18 @@ _PyMem_RawFree(void *Py_UNUSED(ctx), void *ptr)
136136

137137
#ifdef WITH_MIMALLOC
138138

139+
static void
140+
_PyMimalloc_Config(void) {
141+
/* XXX Some options cannot be changed because
142+
PyRuntime_Initialize() -> alloc_for_runtime()
143+
allocates memory, which initializes mimalloc.
144+
145+
verbose logging breaks some tests in debug mode:
146+
"pointer might not point to a valid heap region"
147+
*/
148+
mi_option_disable(mi_option_verbose);
149+
}
150+
139151
static void *
140152
_PyMimalloc_Malloc(void *ctx, size_t size)
141153
{
@@ -429,6 +441,10 @@ _PyMem_SetupAllocators(PyMemAllocatorName allocator)
429441
if (allocator == PYMEM_ALLOCATOR_MIMALLOC_DEBUG) {
430442
PyMem_SetupDebugHooks();
431443
}
444+
445+
// set global mimalloc flags
446+
_PyMimalloc_Config();
447+
432448
break;
433449
}
434450
#endif

0 commit comments

Comments
 (0)