[New-bugs-announce] [issue18203] Replace calls to malloc() with PyMem_Malloc()

STINNER Victor report at bugs.python.org
Thu Jun 13 12:52:39 CEST 2013

New submission from STINNER Victor:

The issue #3329 proposes an API to replace memory allocator functions. But Python calls directly malloc(), realloc() and free() in some functions, so custom allocators would not be used there.

Examples of functions calling malloc/realloc/free directly: _PySequence_BytesToCharpArray(), block_new() (of pyarena.c), find_key() (of thread.c), PyInterpreterState_New(), win32_wchdir(), posix_getcwd(), Py_Main(), etc.

We have to be careful with the GIL: PyMem_*() functions can only be called when holding the GIL.

messages: 191076
nosy: amaury.forgeotdarc, haypo, kristjan.jonsson, ncoghlan
priority: normal
severity: normal
status: open
title: Replace calls to malloc() with PyMem_Malloc()
type: enhancement
versions: Python 3.4

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list