STINNER Victor added the comment:

Hum, there is an issue in the patch version 2: tracemalloc_add_trace() rely on 
the assumption that the pointer is not already tracked. Since we give control 
to the traces to the user, this assumption may become wrong (if the API is 
badly used).

This issue is now fixed in the patch version 3: tracemalloc_add_trace() now 
works if the pointer is already tracked. It allows to implement a 
micro-optimization on realloc() if the new pointer is equal to the old pointer 
(memory block didn't move).

By the way, to track realloc(): _PyTraceMalloc_Untrack() must be called with 
the old pointer and _PyTraceMalloc_Track() must be called with the new pointer. 
I don't think that it's worth to add an helper function just for two calls. 
(The optimization old_ptr==new_ptr is really a micro-optimization, don't use 
tracemalloc if you care of performances, tracemalloc simply kills the 
performance ;-))

----------
Added file: http://bugs.python.org/file42118/tracemalloc_track-3.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26530>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to