When to use PyMem_Malloc()?

"Martin v. Löwis" martin at v.loewis.de
Thu Apr 8 00:56:53 EDT 2004


Jon Perez wrote:
> Are there any disadvantages to using PyMem_Malloc() such that
> there are times when one would prefer to use a plain malloc()?

Certainly. For example, you may have source code which is used
in different projects, so changing the malloc calls may not be
feasible. Or, you may use API function of other libraries that
require you to use malloc(), as they invoke free() themselves.

Regards,
Martin




More information about the Python-list mailing list