r51011 - python/branches/bcannon-sandboxing/Objects/trackedmalloc.c

Author: brett.cannon Date: Tue Aug 1 01:31:49 2006 New Revision: 51011 Modified: python/branches/bcannon-sandboxing/Objects/trackedmalloc.c Log: Add PyObject_AdjustMemory(). Modified: python/branches/bcannon-sandboxing/Objects/trackedmalloc.c ============================================================================== --- python/branches/bcannon-sandboxing/Objects/trackedmalloc.c (original) +++ python/branches/bcannon-sandboxing/Objects/trackedmalloc.c Tue Aug 1 01:31:49 2006 @@ -53,6 +53,7 @@ + Completely convert ElementTree. + Add an adjust function to compliment track/untrack for realloc usage (allows for future usage of tracking active object counts) ++ Try other ways of storing info to optimize lookup. */ unsigned long Py_ProcessMemUsage = 0; @@ -145,6 +146,19 @@ } /* + Adjust the amount of memory used for a specific use. + + In place for possible future use where tracking creation and deletion at the + object level is to be adjusted, and thus reallocs should not count towards + either. +*/ +int +PyObject_AdjustMemory(const char *what, size_t nbytes) +{ + return PyObject_TrackMemory(what, nbytes); +} + +/* Stop tracking an anonymous chunk of memory. */ int @@ -225,7 +239,7 @@ #endif } - PyObject_TrackMemory(what, size_delta); + PyObject_AdjustMemory(what, size_delta); return allocated; }
participants (1)
-
brett.cannon