git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG] Out of memory in Git.pm
@ 2011-03-02 13:01 Robert Wruck
  2011-03-03  8:37 ` Alexander Miseler
  0 siblings, 1 reply; 2+ messages in thread
From: Robert Wruck @ 2011-03-02 13:01 UTC (permalink / raw)
  To: git

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-03-03  8:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-02 13:01 [BUG] Out of memory in Git.pm Robert Wruck
2011-03-03  8:37 ` Alexander Miseler

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).