Hi,
2013/6/21 Antoine Pitrou <[email protected]>:
> 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
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com