Thread (37 messages) flat view 37 messages, 8 authors, 2016-06-15

Re: git-index-pack really does suck..

From: Nicolas Pitre <hidden>
Date: 2016-06-15 22:43:02

On Tue, 3 Apr 2007, Linus Torvalds wrote:

On Tue, 3 Apr 2007, Linus Torvalds wrote:
quoted
and it uses 52s of CPU-time, and on my 4GB machine it actually started 
doing IO and swapping, because git-index-pack grew to 4.8GB in size.
Ahh. False alarm.

The problem is actually largely a really stupid memory leak in the SHA1 
collision checking (which wouldn't trigger on a normal pull, but obviously 
does trigger for every single object when testing!)
Damn!

Please don't report those things when I'm out for lunch so I could have 
a chance to fix my own stupidities myself in time!  :-)
This trivial patch fixes most of it. git-index-pack still uses too much 
memory, but it does a *lot* better.

Junio, please get this into 1.5.1 (I *think* the SHA1 checking is new, but 
if it exists in 1.5.0 too, it obviously needs the same fix).
No, it is new to 1.5.1.
It still grows, but it grew to just 287M in size now for the 170M kernel 
object:

	41.59user 1.39system 0:43.64elapsed
	0major+73552minor

which is quite a lot better.

Duh.
Indeed.

Acked-by: Nicolas Pitre <redacted>
quoted hunk ↗ jump to hunk
 index-pack.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/index-pack.c b/index-pack.c
index 6284fe3..3c768fb 100644
--- a/index-pack.c
+++ b/index-pack.c
@@ -358,6 +358,7 @@ static void sha1_object(const void *data, unsigned long size,
 		if (size != has_size || type != has_type ||
 		    memcmp(data, has_data, size) != 0)
 			die("SHA1 COLLISION FOUND WITH %s !", sha1_to_hex(sha1));
+		free(has_data);
 	}
 }
 
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Nicolas
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help