Another question about extending Python

Martin v. Löwis martin at v.loewis.de
Sat Dec 14 16:40:21 EST 2002


Erik Max Francis <max at alcyone.com> writes:

> A callback system so that a library user can specify the
> allocation/deallocation routines to be used.  This would seem like a
> good idea to include in Python's embedding system, since in the general
> world of library components you've no guarantee that any two components
> will be using the same allocator.

Ah, I see. Such a thing was never requested, and it would have an
unacceptable performance cost. Instead, Python allows you to redefine
the memory allocation macros to something else: defining
PyMEM_MALLOC/REALLOC/FREE, you can replace all allocation functions,
at compile time.

Regards,
Martin



More information about the Python-list mailing list