Author vstinner
Recipients njs, pitrou, vstinner
Date 2016-03-10.16:48:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1457628489.82.0.157404993648.issue26530@psf.upfronthosting.co.za>
In-reply-to
Content
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 ;-))
History
Date User Action Args
2016-03-10 16:48:09vstinnersetrecipients: + vstinner, pitrou, njs
2016-03-10 16:48:09vstinnersetmessageid: <1457628489.82.0.157404993648.issue26530@psf.upfronthosting.co.za>
2016-03-10 16:48:09vstinnerlinkissue26530 messages
2016-03-10 16:48:09vstinnercreate