summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Sergey Vlasov <vsu@altlinux.ru>2005-11-15 19:07:15 +0300
committerLibravatar Junio C Hamano <junkio@cox.net>2005-11-15 11:42:28 -0800
commit545f229a4b43212e683ac63e5aa740324ac7799e (patch)
tree97aa7e16d6e0b7edbeda9fa78740de6e8a4e566a
parentFix git(1) link to git-index-pack (diff)
downloadtgif-545f229a4b43212e683ac63e5aa740324ac7799e.tar.xz
git-fsck-objects: Free tree entries after use
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> Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r--fsck-objects.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fsck-objects.c b/fsck-objects.c
index 17d05363e0..c1b279efcb 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) {