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

Side by Side Diff: tools/tcmalloc/print-live-objects.py

Issue 10544118: Sort memory leaks by size (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Symbolizes and prints live objects as recorded by tcmalloc's 6 """Symbolizes and prints live objects as recorded by tcmalloc's
7 HeapProfilerDumpLiveObjects. 7 HeapProfilerDumpLiveObjects.
8 """ 8 """
9 9
10 import os 10 import os
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 if len(argv) != 3: 73 if len(argv) != 3:
74 usage() 74 usage()
75 sys.exit(1) 75 sys.exit(1)
76 76
77 traces = LoadDump(argv[2]) 77 traces = LoadDump(argv[2])
78 Symbolize(argv[1], traces) 78 Symbolize(argv[1], traces)
79 79
80 if not traces: 80 if not traces:
81 print "No leaks found!" 81 print "No leaks found!"
82 82
83 for trace in traces: 83 for trace in sorted(traces, key=lambda x: -x["size"]):
84 print "Leak of %d bytes at address %s" % (trace["size"], trace["address"]) 84 print "Leak of %d bytes at address %s" % (trace["size"], trace["address"])
85 for frame in trace["frames"]: 85 for frame in trace["frames"]:
86 print " %s (%s)" % (frame["name"], frame["location"]) 86 print " %s (%s)" % (frame["name"], frame["location"])
87 print "" 87 print ""
88 88
89 89
90 if __name__ == '__main__': 90 if __name__ == '__main__':
91 Main(sys.argv) 91 Main(sys.argv)
OLDNEW
« 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