[issue3329] API for setting the memory allocator used by Python

STINNER Victor report at bugs.python.org
Tue Jun 11 13:59:00 CEST 2013


STINNER Victor added the comment:

Amaury Forgeot d'Arc added the comment:
> I prefer the new version without PYMEM_TRACE_MALLOC :-)

Well, py_setallocators-filename.patch is more a proof-of-concept
showing how to use my Py_SetAllocators() API to pass the C trace
(filename/line number), than a real proposition. The patch is very
intrusive and huge, I also prefer py_setallocators-3.patch :-)

> Can we rename "API" and "api_id" to something more specific? maybe DOMAIN and domain_id?

Something like:
{PY_ALLOC_MEM_DOMAIN, PY_ALLOC_OBJECT_DOMAIN}.
or
{PYMEM_DOMAIN, PYOBJECT_DOMAIN}
?

There are only two values, another option is to duplicate functions:
- PyMem_GetAllocators(), PyMem_SetAllocators(), PyMem_Malloc(), ..
- PyObject_GetAllocators(), PyObject_SetAllocators(), PyObject_Malloc(), ..

I prefer PyMem_SetAllocators() over PYOBJECT_DOMAIN.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3329>
_______________________________________


More information about the Python-bugs-list mailing list