I have a C extension module for Python.
When the module is initialized, I malloc() some memory that I only use in the C code.
I would like to free this memory when the module is freed.
Python 3 has m_free member on PyModuleDef struct that is exactly what I want. The problem is I cannot find equivalent functionality in Python 2.
How do I free my malloc'd memory in Python 2?
I suppose there is no direct equivalent, that's why m_free is introduced in 3.0, see
pep 3121
for details: