From: Robert Wruck <wruck@tweerlei.de>
To: git@vger.kernel.org
Subject: [BUG] Out of memory in Git.pm
Date: Wed, 02 Mar 2011 14:01:43 +0100 [thread overview]
Message-ID: <4D6E3FB7.60600@tweerlei.de> (raw)
Hi,
there seems to be a problem in Git.pm (git-1.7.4.1, sub cat_blob, line
891) where the whole object is read into memory ($blob) before writing
to $fh:
my $blob;
my $bytesRead = 0;
while (1) {
my $bytesLeft = $size - $bytesRead;
last unless $bytesLeft;
my $bytesToRead = $bytesLeft < 1024 ? $bytesLeft : 1024;
my $read = read($in, $blob, $bytesToRead, $bytesRead);
unless (defined($read)) {
$self->_close_cat_blob();
throw Error::Simple("in pipe went bad");
}
$bytesRead += $read;
}
Maybe it would be better to write each chunk directly to $fh ?
If so, I could create a patch.
-Robert
next reply other threads:[~2011-03-02 13:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-02 13:01 Robert Wruck [this message]
2011-03-03 8:37 ` [BUG] Out of memory in Git.pm Alexander Miseler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D6E3FB7.60600@tweerlei.de \
--to=wruck@tweerlei.de \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).