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
|
#ifdef MS_WINDOWS
|
||||||
|
/* Unlike free(), VirtualFree() does not special-case NULL to noop. */
|
||||||
|
if (ptr == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
VirtualFree(ptr, 0, MEM_RELEASE);
|
VirtualFree(ptr, 0, MEM_RELEASE);
|
||||||
#elif defined(ARENAS_USE_MMAP)
|
#elif defined(ARENAS_USE_MMAP)
|
||||||
|
/* Unlike free(), munmap() does not special-case NULL to noop. */
|
||||||
|
if (ptr == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
munmap(ptr, size);
|
munmap(ptr, size);
|
||||||
#else
|
#else
|
||||||
free(ptr);
|
free(ptr);
|
||||||
|
|
Loading…
Reference in New Issue