[issue26530] tracemalloc: add C API to manually track/untrack memory allocations
STINNER Victor
report at bugs.python.org
Thu Mar 10 11:07:56 EST 2016
STINNER Victor added the comment:
Antoine Pitrou:
> This may indeed be useful but:
> - those functions should be no-ops when tracing isn't enabled (so as to be as fast as possible)
Done
> - you should take the GIL if necessary (but only if tracing is enabled, of course)
Ok, done.
The new patch has a safer API:
* _PyTraceMalloc_Track() can be called twice with the same pointer: the old trace is removed, a new trace is added
* _PyTraceMalloc_Track() ensures that the GIL is hold
* _PyTraceMalloc_Track() & _PyTraceMalloc_Untrack() do nothing if tracemalloc is disabled
I also added unit tests.
----------
Added file: http://bugs.python.org/file42116/tracemalloc_track-2.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26530>
_______________________________________
More information about the Python-bugs-list
mailing list