Bug 1367852 - Defer file read to reduce peak memory use in mozjar when dumping symbols. r=ted

Passing a file object intead of a string of the file's contents defers reading
the file to a place Python can free the resulting string earlier, reducing
peak memory consumption when packaging symbols and avoiding a MemoryError on
Windows 32 builders in automation.


MozReview-Commit-ID: H0R6BbjwhOu

--HG--
extra : rebase_source : 181b592ab503d0545f34d167d7c05428455b6671
This commit is contained in:
Chris Manchester 2017-05-30 12:11:21 -07:00
parent fbf5749494
commit 0b448c1224

View File

@ -25,7 +25,7 @@ def make_archive(archive_name, base, exclude, include, compress):
for p, f in finder.find(pat):
print(' Adding to "%s":\n\t"%s"' % (archive_basename, p))
should_compress = any(mozpath.match(p, pat) for pat in compress)
writer.add(p.encode('utf-8'), f.read(), mode=f.mode,
writer.add(p.encode('utf-8'), f, mode=f.mode,
compress=should_compress, skip_duplicates=True)
def main(argv):