Le Tue, 18 Jun 2013 22:40:49 +0200, Victor Stinner <victor.stin...@gmail.com> a écrit : > > Other changes > ------------- > [...] > > * Configure external libraries like zlib or OpenSSL to allocate memory > using ``PyMem_RawMalloc()``
Why so, and is it done by default? > Only one get/set function for block allocators > ---------------------------------------------- > > Replace the 6 functions: > > * ``void PyMem_GetRawAllocator(PyMemBlockAllocator *allocator)`` > * ``void PyMem_GetAllocator(PyMemBlockAllocator *allocator)`` > * ``void PyObject_GetAllocator(PyMemBlockAllocator *allocator)`` > * ``void PyMem_SetRawAllocator(PyMemBlockAllocator *allocator)`` > * ``void PyMem_SetAllocator(PyMemBlockAllocator *allocator)`` > * ``void PyObject_SetAllocator(PyMemBlockAllocator *allocator)`` > > with 2 functions with an additional *domain* argument: > > * ``int PyMem_GetBlockAllocator(int domain, PyMemBlockAllocator > *allocator)`` > * ``int PyMem_SetBlockAllocator(int domain, PyMemBlockAllocator > *allocator)`` I would much prefer this solution. > Drawback: the caller has to check if the result is 0, or handle the > error. Or you can just call Py_FatalError() if the domain is invalid. > If an hook is used to the track memory usage, the ``malloc()`` memory > will not be seen. Remaining ``malloc()`` may allocate a lot of memory > and so would be missed in reports. A lot of memory? In main()? Regards Antoine. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com