]> git.ipfire.org Git - thirdparty/git.git/commitdiff
git-svn: avoid a huge memory spike with high-numbered revisions
authorEric Wong <normalperson@yhbt.net>
Wed, 31 Jan 2007 13:13:30 +0000 (05:13 -0800)
committerEric Wong <normalperson@yhbt.net>
Fri, 23 Feb 2007 08:57:11 +0000 (00:57 -0800)
Passing very large strings as arguments is bad for memory usage
as it never seems to get freed in Perl.  The .rev_db format is
already not optimized for projects with sparse history.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
git-svn.perl

index efc55156639316259a246e50d8ae7a51439b8155..ddb038260851659c90070fb0e42ad4458e86ce2f 100755 (executable)
@@ -1345,8 +1345,9 @@ sub rev_db_set {
        seek $fh, 0, 2 or croak $!;
        my $pos = tell $fh;
        if ($pos < $offset) {
-               print $fh (('0' x 40),"\n") x (($offset - $pos) / 41)
-                 or croak $!;
+               for (1 .. (($offset - $pos) / 41)) {
+                       print $fh (('0' x 40),"\n") or croak $!;
+               }
        }
        seek $fh, $offset, 0 or croak $!;
        print $fh $commit,"\n" or croak $!;