This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients njs, pitrou, vstinner
Date 2016-03-10.16:48:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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 ;-))
Date User Action Args
2016-03-10 16:48:09vstinnersetrecipients: + vstinner, pitrou, njs
2016-03-10 16:48:09vstinnersetmessageid: <>
2016-03-10 16:48:09vstinnerlinkissue26530 messages
2016-03-10 16:48:09vstinnercreate