]> granicus.if.org Git - python/commit
Issue #3329: Add new APIs to customize memory allocators
authorVictor Stinner <victor.stinner@gmail.com>
Fri, 14 Jun 2013 22:37:46 +0000 (00:37 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Fri, 14 Jun 2013 22:37:46 +0000 (00:37 +0200)
commit4d7056258b07df7cbb1b9b44e7a1a9bad04f7454
treef5b3d2b16be7b8d16dd234ac59c722d0ca24e0b4
parent8c18da20f979cf428414a038bfaee46283e12fa2
Issue #3329: Add new APIs to customize memory allocators

* Add a new PyMemAllocators structure
* New functions:

  - PyMem_RawMalloc(), PyMem_RawRealloc(), PyMem_RawFree(): GIL-free memory
    allocator functions
  - PyMem_GetRawAllocators(), PyMem_SetRawAllocators()
  - PyMem_GetAllocators(), PyMem_SetAllocators()
  - PyMem_SetupDebugHooks()
  - _PyObject_GetArenaAllocators(), _PyObject_SetArenaAllocators()

* Add unit test for PyMem_Malloc(0) and PyObject_Malloc(0)
* Add unit test for new get/set allocators functions
* PyObject_Malloc() now falls back on PyMem_Malloc() instead of malloc() if
  size is bigger than SMALL_REQUEST_THRESHOLD, and PyObject_Realloc() falls
  back on PyMem_Realloc() instead of realloc()
* PyMem_Malloc() and PyMem_Realloc() now always call malloc() and realloc(),
  instead of calling PyObject_Malloc() and PyObject_Realloc() in debug mode
Doc/c-api/memory.rst
Include/objimpl.h
Include/pymem.h
Modules/_testcapimodule.c
Objects/object.c
Objects/obmalloc.c