Permalink
Browse files

Reduce the spike of memory usage when closing the GitHgStore

On a clone of mozilla-central, filling hg2git_files with new strings
fills up > 1GB of memory.
  • Loading branch information...
glandium committed Mar 9, 2017
1 parent 16af099 commit 3ecd5873132b33668f7d3b1f3f8b2f40eaee1b1b
Showing with 3 additions and 3 deletions.
  1. +3 −3 cinnabar/githg.py
View
@@ -1256,17 +1256,17 @@ def close(self):
for node, mark in dic.iteritems():
if dic is self._git_files and node == HG_EMPTY_FILE:
continue
hg2git_files.append((sha1path(node), mark, typ))
hg2git_files.append((node, mark, typ))
if hg2git_files:
with self._fast_import.commit(
ref='refs/cinnabar/hg2git',
from_commit=Git.resolve_ref('refs/cinnabar/hg2git'),
) as commit:
for file in sorted(hg2git_files, key=lambda f: f[0]):
if file[1] is None:
commit.filedelete(file[0])
commit.filedelete(sha1path(file[0]))
else:
commit.filemodify(*file)
commit.filemodify(sha1path(file[0]), *file[1:])
del hg2git_files

0 comments on commit 3ecd587

Please sign in to comment.