• John Kirkham's avatar
    Add Python Raw memory helper functions · 9fbbf216
    John Kirkham authored
    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.
    9fbbf216
mem.pxd 5.55 KB