Hello, I've been appointed PEP 445 delegate by Nick and Guido. I would like to know if there are still pending changes to the PEP. If not, I expect to give it a review in the coming days or weeks, and then make a final pronouncement (which will probably be positive anyway). Regards Antoine.
Hi, 2013/6/21 Antoine Pitrou <solipsis@pitrou.net>:
I've been appointed PEP 445 delegate by Nick and Guido. I would like to know if there are still pending changes to the PEP.
Cool. Hum, there is maybe something. In my pytracemalloc project, I added another API to track usage of free lists: PyAPI_FUNC(int) _PyFreeList_SetAllocators( void (*alloc) (PyObject *), void (*free) (PyObject *) ); PyAPI_FUNC(void) _PyFreeList_Alloc(void *); PyAPI_FUNC(void) _PyFreeList_Free(void *); Then I'm using Py_TYPE(op)->tp_basicsize to get the size of the object. I didn't add this API to the PEP because I'm not really convinced that is useful. I wrote it becase Python 2 has unlimited free lists, especially for the int type. In Python 3, the situation is different: free lists have a limited size, and the "int" type of Python 3 is the old "long" type, and int in Python 3 does not use a free list. (By the way, it may provide better performances if we had a free list for "small" ints.) I expect better results with the new PyMem_RawMalloc() function and the "Don't call malloc() directly anymore" section of the PEP than with tracking free lists. I'm testing Python 3.4 with all patches related to the PEP 445 (#3329, #16742, #18203) and it works fine. You can also try my pytracemalloc project with its "userdata" branch. I just found a bug in pytracemalloc for allocation of zero bytes :-) Victor
Hi, 2013/6/21 Antoine Pitrou <solipsis@pitrou.net>:
I've been appointed PEP 445 delegate by Nick and Guido. I would like to know if there are still pending changes to the PEP. If not, I expect to give it a review in the coming days or weeks, and then make a final pronouncement (which will probably be positive anyway).
As you asked on IRC, I added a section to the PEP 445 explaining in detail the redesign of debug checks on memory allocators: http://www.python.org/dev/peps/pep-0445/#redesign-debug-checks-on-memory-all... The section show also how "hooks" work in the simple "call traces" example. Hooks are just inserted between the public function (ex: PyMem_Malloc) and the inner allocator function (ex: _PyMem_RawMalloc()). Minor nit: in practice, there is only one "debug hook" (reused on 3 allocators), so we may drop the trailing "s" from the name "PyMem_SetupDebugHooks". Diff on pep-0445.txt: http://hg.python.org/peps/rev/c6199202522a Victor
participants (2)
-
Antoine Pitrou
-
Victor Stinner