mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
PyMem_Malloc() now uses the fast pymalloc allocator
Issue #26249: PyMem_Malloc() allocator family now uses the pymalloc allocator rather than system malloc(). Applications calling PyMem_Malloc() without holding the GIL can now crash: use PYTHONMALLOC=debug environment variable to validate the usage of memory allocators in your application.
This commit is contained in:
parent
5439fc4901
commit
f5c4b99034
5 changed files with 58 additions and 32 deletions
|
|
@ -628,12 +628,11 @@ conflict.
|
|||
Set the family of memory allocators used by Python:
|
||||
|
||||
* ``malloc``: use the :c:func:`malloc` function of the C library
|
||||
for all Python memory allocators (ex: :c:func:`PyMem_RawMalloc`,
|
||||
:c:func:`PyMem_Malloc` and :c:func:`PyObject_Malloc`).
|
||||
* ``pymalloc``: :c:func:`PyObject_Malloc`, :c:func:`PyObject_Calloc` and
|
||||
:c:func:`PyObject_Realloc` use the :ref:`pymalloc allocator <pymalloc>`.
|
||||
Other Python memory allocators (ex: :c:func:`PyMem_RawMalloc` and
|
||||
:c:func:`PyMem_Malloc`) use :c:func:`malloc`.
|
||||
for all domains (:c:data:`PYMEM_DOMAIN_RAW`, :c:data:`PYMEM_DOMAIN_MEM`,
|
||||
:c:data:`PYMEM_DOMAIN_OBJ`).
|
||||
* ``pymalloc``: use the :ref:`pymalloc allocator <pymalloc>` for
|
||||
:c:data:`PYMEM_DOMAIN_MEM` and :c:data:`PYMEM_DOMAIN_OBJ` domains and use
|
||||
the :c:func:`malloc` function for the :c:data:`PYMEM_DOMAIN_RAW` domain.
|
||||
|
||||
Install debug hooks:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue