Here my comments, from more general to more subtle:
- please don't post patches here; post them to SF You may ask for comments here after you posted them to SF. - please follow Python coding style. In particular, don't write if ( available_arenas == NULL ) { but write if (available_arenas == NULL) {
Second, the previous allocator went out of its way to permit a module to call PyObject_Free while another thread is executing PyObject_Malloc. Apparently, this was a backwards compatibility hack for old Python modules which erroneously call these functions without holding the GIL. These modules will have to be fixed if this implementation is accepted into the core.
I'm not certain it is acceptable to make this assumption. Why is it not possible to use the same approach that was previously used (i.e. leak the arenas array)?
- When allocating a page, it is taken from the arena that is the most full. This gives arenas that are almost completely unused a chance to be freed.
It would be helpful if that was documented in the data structures somewhere. The fact that the nextarena list is sorted by nfreepools is only mentioned in the place where this property is preserved; it should be mentioned in the introductory comments as well.
Regards, Martin _______________________________________________ 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