git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[BUG] Out of memory in Git.pm

From
RWRobert Wruck <wruck@tweerlei.de>
Date
Mar 2, 2011, 13:01 UTC
Message-ID
<4D6E3FB7.60600@tweerlei.de>
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: Alexander Miseler
Message 1 of 2 in “[BUG] Out of memory in Git.pm”
  1. Robert WruckMar 2, 2011
  2. Alexander MiselerMar 3, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.