Message191248
| 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:49 | vstinner | set | recipients:
+ vstinner, christian.heimes |
| 2013年06月15日 23:27:49 | vstinner | set | messageid: <1371338869.58.0.00725626403199.issue18227@psf.upfronthosting.co.za> |
| 2013年06月15日 23:27:49 | vstinner | link | issue18227 messages |
| 2013年06月15日 23:27:49 | vstinner | create |
|