Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(576)

Unified Diff: tools/heapcheck/heapcheck_test.py

Issue 6220004: Don't report duplication stacks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/tools/heapcheck
Patch Set: updates Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/heapcheck/heapcheck_test.py
diff --git a/tools/heapcheck/heapcheck_test.py b/tools/heapcheck/heapcheck_test.py
index 9c1165fde48d732b7559a0456b96817b6fde3003..2e86e81a8671042604ca2ed1e499f79b7946327c 100644
--- a/tools/heapcheck/heapcheck_test.py
+++ b/tools/heapcheck/heapcheck_test.py
@@ -89,6 +89,7 @@ class HeapcheckWrapper(object):
cur_leak_signature = None
cur_stack = []
cur_report = []
+ reported_hashes = {}
# Statistics grouped by suppression description:
# [hit count, bytes, objects].
used_suppressions = {}
@@ -115,24 +116,26 @@ class HeapcheckWrapper(object):
print ' ' + frame
print 'Aborting...'
return 3
- # Print the report and set the return code to 1.
- print ('Leak of %d bytes in %d objects allocated from:'
- % tuple(cur_leak_signature))
- print '\n'.join(cur_report)
- return_code = 1
- # Generate the suppression iff the stack contains more than one
- # frame (otherwise it's likely to be broken)
- if len(cur_stack) > 1:
- print '\nSuppression (error hash=#%016X#):\n{' \
- % (hash("".join(cur_stack)) & 0xffffffffffffffff)
- print ' <insert_a_suppression_name_here>'
- print ' Heapcheck:Leak'
- for frame in cur_stack:
- print ' fun:' + frame
- print '}\n\n\n'
- else:
- print ('This stack may be broken due to omitted frame pointers. '
- 'It is not recommended to suppress it.')
+ error_hash = hash("".join(cur_stack)) & 0xffffffffffffffff
+ if error_hash not in reported_hashes:
+ reported_hashes[error_hash] = 1
+ # Print the report and set the return code to 1.
+ print ('Leak of %d bytes in %d objects allocated from:'
+ % tuple(cur_leak_signature))
+ print '\n'.join(cur_report)
+ return_code = 1
+ # Generate the suppression iff the stack contains more than one
+ # frame (otherwise it's likely to be broken)
+ if len(cur_stack) > 1:
+ print '\nSuppression (error hash=#%016X#):\n{' % (error_hash)
+ print ' <insert_a_suppression_name_here>'
+ print ' Heapcheck:Leak'
+ for frame in cur_stack:
+ print ' fun:' + frame
+ print '}\n\n\n'
+ else:
+ print ('This stack may be broken due to omitted frame pointers.'
+ ' It is not recommended to suppress it.')
else:
# Update the suppressions histogram.
if description in used_suppressions:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698