This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients christian.heimes, vstinner
Date 2013-06-15.23:27:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1371338869.58.0.00725626403199.issue18227@psf.upfronthosting.co.za>
In-reply-to
Content
With the PEP 445 and the issue #3329, Python will get an API to setup custom memory allocators. To be able to configure how memory is handled in external libraries, some libraries allow to setup a custom allocator too. New functions PyMem_RawMalloc(), PyMem_GetRawAllocators() PyMem_SetRawAllocators() can be used for that.

The safest option is to only reuse custom allocators if a library allows to setup them for a specfic function call or a specific object, and not replace the memory allocators globally. For example, the lzma library allows to set memory allocators only for one compressor object: LzmaEnc_Create(&SzAllocForLzma);

We might change the global allocators of a library if Python is not embedded, but Python *is* the application (the standard "python" program).

I don't know yet if it is safe to reuse custom memory allocators.

Windows has for example a special behaviour: each DLL (dynamic library) has its own heap, memory allocator in a DLL cannot be released from another DLL. Would this issue introduce such bug?
History
Date User Action Args
2013-06-15 23:27:49vstinnersetrecipients: + vstinner, christian.heimes
2013-06-15 23:27:49vstinnersetmessageid: <1371338869.58.0.00725626403199.issue18227@psf.upfronthosting.co.za>
2013-06-15 23:27:49vstinnerlinkissue18227 messages
2013-06-15 23:27:49vstinnercreate