+class Blob:
+ '''Data-less proxy for bytearrays, to save memory.'''
+
+ def __init__(self, size, hash):
+ self.size = size
+ self.hash = hash
+
+ def __repr__(self):
+ return 'blob(%u)' % self.size
+
+ def __eq__(self, other):
+ return self.size == other.size and self.hash == other.hash
+
+ def __hash__(self):
+ return self.hash
+
+
+class BlobReplacer(Rebuilder):
+ '''Replace blobs with proxys.'''
+
+ def visitByteArray(self, obj):
+ return Blob(len(obj), hash(str(obj)))
+
+ def visitCall(self, call):
+ call.args = map(self.visit, call.args)
+ call.ret = self.visit(call.ret)
+
+