diff options
| author | Victor Stinner <victor.stinner@gmail.com> | 2016-04-22 16:26:23 +0200 |
|---|---|---|
| committer | Victor Stinner <victor.stinner@gmail.com> | 2016-04-22 16:26:23 +0200 |
| commit | f5c4b99034fae12ac2b9498dd12b5b3f352b90c8 (patch) | |
| tree | 743fb9af0ea98b29e696aa920d4823d30acf483f /Objects/obmalloc.c | |
| parent | 5439fc4901dbc7ab0fc0c8d2b2266e05d0019a92 (diff) | |
| download | cpython-git-f5c4b99034fae12ac2b9498dd12b5b3f352b90c8.tar.gz | |
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.
Diffstat (limited to 'Objects/obmalloc.c')
| -rw-r--r-- | Objects/obmalloc.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c index 6cf8ea9018..d305b1d75d 100644 --- a/Objects/obmalloc.c +++ b/Objects/obmalloc.c @@ -198,9 +198,9 @@ static PyMemAllocatorEx _PyMem_Raw = { static PyMemAllocatorEx _PyMem = { #ifdef Py_DEBUG - &_PyMem_Debug.mem, PYDBG_FUNCS + &_PyMem_Debug.obj, PYDBG_FUNCS #else - NULL, PYMEM_FUNCS + NULL, PYOBJ_FUNCS #endif }; @@ -256,7 +256,7 @@ _PyMem_SetupAllocators(const char *opt) PyMemAllocatorEx obj_alloc = {NULL, PYOBJ_FUNCS}; PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &mem_alloc); - PyMem_SetAllocator(PYMEM_DOMAIN_MEM, &mem_alloc); + PyMem_SetAllocator(PYMEM_DOMAIN_MEM, &obj_alloc); PyMem_SetAllocator(PYMEM_DOMAIN_OBJ, &obj_alloc); if (strcmp(opt, "pymalloc_debug") == 0) |
