[issue43313] feature: support pymalloc for subinterpreters. each subinterpreter has pymalloc_state

junyixie report at bugs.python.org
Mon Mar 15 09:03:16 EDT 2021


junyixie <xie.junyi at outlook.com> added the comment:

There is a problem:
if we bound pymalloc state with a interpreter.
malloc pointer in interpreterA and free pointer is usual.

it's cause a problem. 
when we use PyObject_Free, 
1. we look up address in pymalloc pool.
2. if not find, current code will call PyMem_RawFree(p) to free. it will cause crash.(address is pymalloc_alloc from another interpreter)

I think it has two way to slove this problem:
1. free/alloc memory in one interpreter. Frequent switch interpreter affects performance
2. when free memory address, find this address in all interpreter pymalloc pool. and free it.(but it need add lock to pymalloc)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43313>
_______________________________________


More information about the Python-bugs-list mailing list