Hacker News new | ask | show | jobs
by Scaevolus 4684 days ago
All you need to do is set the appropriate type's tp_alloc/tp_dealloc function pointers [1] (type-specific malloc/free functions). Dropbox was having fragmentation issues from the large amount of garbage generated while scanning the filesystem, and making memory allocation use type-specific memory pools fixed it.

    [1] http://docs.python.org/2/c-api/typeobj.html#PyTypeObject.tp_alloc