mirror of https://github.com/python/cpython
gh-121460: Skip freeing unallocated arenas (gh-121491)
`munmap(NULL)` is not noop, like `free(NULL)` is. Fixes an observed testsuite hang on 32-bit ARM systems.
This commit is contained in:
parent
0177a34335
commit
a802277914
|
@ -386,8 +386,16 @@ _PyMem_ArenaFree(void *Py_UNUSED(ctx), void *ptr,
|
|||
)
|
||||
{
|
||||
#ifdef MS_WINDOWS
|
||||
/* Unlike free(), VirtualFree() does not special-case NULL to noop. */
|
||||
if (ptr == NULL) {
|
||||
return;
|
||||
}
|
||||
VirtualFree(ptr, 0, MEM_RELEASE);
|
||||
#elif defined(ARENAS_USE_MMAP)
|
||||
/* Unlike free(), munmap() does not special-case NULL to noop. */
|
||||
if (ptr == NULL) {
|
||||
return;
|
||||
}
|
||||
munmap(ptr, size);
|
||||
#else
|
||||
free(ptr);
|
||||
|
|
Loading…
Reference in New Issue