Add Python Raw memory helper functions
In Python 3.4+, Raw memory helper functions were added to wrap, track, and check `malloc` and `free` calls for C memory outside of the GIL. These have the same API as the existing `PyMem_*` calls except they use Raw and never require the GIL. For Python 2/3 compatibility, export the existing `PyMem_` functions on Python 2 as `PyMem_Raw` where they act basically equivalently. These are especially important as Python 3.6 changed the existing `PyMem_` functions to allocate from pymalloc instead of the C allocator meaning the GIL must now be held with them. So these are Python 2/3 alternatives that can be relied on to not require the GIL.
Showing
Please register or sign in to comment