Thread (1 message) 1 message, 1 author, 2016-06-15

Re: Git usage and resource usage

From: Darren Williams <hidden>
Date: 2016-06-15 22:41:52

Hi Erik

On Wed, 13 Apr 2005, Erik van Konijnenburg wrote:
On Wed, Apr 13, 2005 at 11:06:22PM +1000, Darren Williams wrote:
quoted
  Git(pasky) requires an excessive quantity of file
descriptors, more than 1024 in a simple case and
more than 16384 in a high workload case.
Does this help?  Posted earlier today to the list,
but since there are no archives yet its hard to find.
Yes that fixes it.

% ulimit -n
1024 

% quilt pop -a
% time git commit
...
Enter commit message, terminated by ctrl-D on a separate line:

real    0m7.762s
user    0m7.282s
sys     0m0.459s
quoted hunk
Regards,
Erik

tree 70189060273990e945015845a1d97c03eac2346a
parent 97c9a63e76bf667c21f24a5cfa8172aff0dd1294
author Erik van Konijnenburg,,, <konijn@framboos> Wed Apr 13 13:32:13 2005
committer Erik van Konijnenburg,,, <konijn@framboos> Wed Apr 13 13:32:13 2005

avoid fd leak.
.
Index: read-cache.c
===================================================================
--- 833bb44b8e49daf0424f44cf300748da17945859/read-cache.c  (mode:100644 sha1:7cdd0f82992789e64f6ea272e43ee4af8cdf7f2a)
+++ 70189060273990e945015845a1d97c03eac2346a/read-cache.c  (mode:100644 sha1:7957377f2ddd107aa686f3ca4da51b74e6679baf)
@@ -251,11 +251,15 @@
 		if (fd < 0)
 			return -1;
 		map = mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);
-		if (map == MAP_FAILED)
+		if (map == MAP_FAILED) {
+			close(fd);
 			return -1;
+		}
 		if (memcmp(buf, map, size))
 			return error("SHA1 collision detected!"
 					" This is bad, bad, BAD!\a\n");
+		munmap(map, size);
+		close(fd);
 #endif
 		return 0;
 	}
--------------------------------------------------
Darren Williams <dsw AT gelato.unsw.edu.au>
Gelato@UNSW <www.gelato.unsw.edu.au>
--------------------------------------------------
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help