Git development
 help / color / mirror / Atom feed
* [PATCH] git-fsck-objects: Free tree entries after use
@ 2005-11-15 16:07 Sergey Vlasov
  0 siblings, 0 replies; only message in thread
From: Sergey Vlasov @ 2005-11-15 16:07 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

The Massif tool of Valgrind revealed that parsed tree entries occupy
more than 60% of memory allocated by git-fsck-objects.  These entries
can be freed immediately after use, which significantly decreases
memory consumption.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>


---

 fsck-objects.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

applies-to: 4b6dbe856a3e63699b299c76f4f1fc5cb34cbe26
0742a20134cc7f58f2c4cbc982a3eb115c6eaf47
diff --git a/fsck-objects.c b/fsck-objects.c
index 17d0536..c1b279e 100644
--- a/fsck-objects.c
+++ b/fsck-objects.c
@@ -184,10 +184,17 @@ static int fsck_tree(struct tree *item)
 			default:
 				break;
 			}
+			free(last->name);
+			free(last);
 		}
 
 		last = entry;
 	}
+	if (last) {
+		free(last->name);
+		free(last);
+	}
+	item->entries = NULL;
 
 	retval = 0;
 	if (has_full_path) {
---
0.99.9.GIT

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2005-11-15 16:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-15 16:07 [PATCH] git-fsck-objects: Free tree entries after use Sergey Vlasov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox