• Victor Stinner's avatar
    Issue #3329: Add new APIs to customize memory allocators · 4d705625
    Victor Stinner yazdı
    * 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
    4d705625
objimpl.h 13.3 KB