{"categories":[{"label":"Scientific/Engineering","url":"https://skillfed.io/packages/category/scientific-engineering"}],"enrichment":{"capability":"cymem provides memory-management helpers for Cython that tie C-allocated memory to Python object lifecycles, automatically freeing memory when the object is garbage collected.","skillfed_tags":["cython","memory-management","c-extension"],"use_cases":["Building arrays of C structs in Cython without writing complex __dealloc__ methods.","Wrapping external C libraries that use private malloc/free functions via custom allocators.","Managing deeply nested C data structures where manual deallocation is error-prone.","Reducing memory-leak bugs in performance-critical Cython extensions.","Simplifying memory lifecycle in Cython classes that hold C-level pointers."],"what_it_does":"cymem is a Cython library that wraps C's calloc/free functions in a Python-managed Pool object. Instead of manually tracking and freeing allocated memory in Cython code, you attach a Pool to your Cython class and call pool.alloc() for all memory allocations. When the Pool is garbage collected (along with its parent object), all tracked memory is automatically freed\u2014eliminating manual deallocation code and the bugs that come with it.\n\nThe library is designed for performance-critical Cython code that works with C-level structs and arrays. It supports custom allocators via WrapMalloc and WrapFree, and as of version 2.0.12, is thread-safe on CPython 3.13+ free-threaded builds. With no runtime dependencies and precompiled wheels for modern Python versions and architectures, it integrates cleanly into existing Cython projects.","worth_installing":"Yes, if you write Cython code that allocates C memory. cymem eliminates a common source of bugs (manual deallocation) and is actively maintained with no known vulnerabilities. Install friction is medium due to Cython and compiler requirements, but that's inherent to Cython development, not cymem itself. Not relevant for pure-Python projects."},"id":"cymem","links":{"html":"https://skillfed.io/packages/cymem","md":"https://skillfed.io/packages/cymem.md","pypi":"https://pypi.org/project/cymem/"},"maintenance":{"status":"active"},"meta":{"latest_release":"2025-11-14","license_spdx":null,"license_treatment":"permissive","name":"cymem","python_support":"supports_current","summary":"Manage calls to calloc/free through Cython"},"popularity":{"monthly_downloads":21449015,"position":1001,"tier":"top_5000"},"security":{"n_vulnerabilities":0},"version":"2.0.13"}
