commit - 475777eaa2715294c014b2333b23b29e9c5083f3
commit + 63f886b17113fc454e9bee0d414ad13f433b1989
blob - 3d82567d754404fab91d904cf3469ba9bde25227
blob + 26db34e700d231ba149f3dea02860620fdd357db
--- memtrace.py
+++ memtrace.py
print "RESETTING tracer on '%s'" % reset
r_malloc = re.compile("([^#]*)#m:(0x[0-9a-f]+);(0x[0-9a-f]+)-(\\d+)")
+r_calloc = re.compile("([^#]*)#c:(0x[0-9a-f]+);(0x[0-9a-f]+)-(\\d+);(\\d+)")
r_realloc = re.compile("([^#]*)#r:(0x[0-9a-f]+);(0x[0-9a-f]+)-(0x[0-9a-f]+);(\\d+)")
r_free = re.compile("([^#]*)#f:(0x[0-9a-f]+);(0x[0-9a-f]+)-(0x[0-9a-f]+)")
(len(mem), allocated, allocated, int(m.group(4)), line.replace(m.group(1), ""))
continue
+ m = r_calloc.search(line)
+ if m:
+ if len(m.group(1)): print m.group(1)
+ # print "c", m.group(2), ":", m.group(4), "*", m.group(5)
+ if m.group(2) == "0x0":
+ print "\033[1m!! (%03d) \033[31mcalloc failed\033[0m (%s)" % (len(mem), line)
+ else:
+ total = int(m.group(4)) * int(m.group(5))
+ mem[m.group(2)] = total
+ allocated += total
+ print "\033[1m== (%03d) \033[34m%8d\033[0m [%8x] \033[31m+%-6d\033[0m (%s)" % \
+ (len(mem), allocated, allocated, total, line.replace(m.group(1), ""))
+ continue
+
m = r_realloc.search(line)
if m:
if len(m.group(1)): print m.group(1)