git-svn: avoid a huge memory spike with high-numbered revisions

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>
This commit is contained in:
Eric Wong 2007-01-31 05:13:30 -08:00
parent d4eff2bda5
commit 47a0b75e01

View File

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