cymem

Manage memory allocation calls in Cython code efficiently.

pipmacoslinuxwindows
Try with needOr install directly
Source

About

Manage calls to calloc/free through Cython

Examples

install cymem library for Python project$ pip install cymem
use cymem in Cython code to wrap malloc calls$ from cymem.mpool cimport Pool cdef Pool mem = Pool() cdef void* ptr = mem.alloc(100, sizeof(char))
allocate memory safely in Cython with automatic cleanup$ from cymem.mpool cimport Pool cdef Pool pool = Pool() cdef char* buffer = <char*>pool.alloc(1024, sizeof(char))
free allocated memory through cymem pool interface$ cdef Pool mem = Pool() mem.free(ptr) del mem
check cymem version installed$ python -c "import cymem; print(cymem.__version__)"