[Python-Dev] RFC: PEP 445: Add new APIs to customize Python memory allocators (original) (raw)

Scott Dial scott+python-dev at scottdial.com
Wed Jun 19 06:33:54 CEST 2013


On 6/18/2013 11:32 PM, Nick Coghlan wrote:

Agreed more of that rationale needs to be moved from the issue tracker into the PEP, though.

Thanks for the clarification. I hadn't read the issue tracker at all. On it's face value, I didn't see what purpose it served, but having read Kristján's comments on the issue tracker, he would like to store state for the allocators in that ctx pointer.[1] Having read that (previously, I thought the only utility was distinguishing which domain it was -- a small, glorified enumeration), but his use-case makes sense and definitely is informative to have in the PEP, because the utility of that wasn't obvious to me.

Thanks, -Scott

[1] http://bugs.python.org/issue3329#msg190529 """ One particular trick we have been using, which might be of interest, is to be able to tag each allocation with a "context" id. This is then set according to a global sys.memcontext variable, which the program will modify according to what it is doing. This can then be used to track memory usage by different parts of the program. """

-- Scott Dial scott at scottdial.com



More information about the Python-Dev mailing list