From: Sergey Vlasov Date: Tue, 15 Nov 2005 16:07:15 +0000 (+0300) Subject: git-fsck-objects: Free tree entries after use X-Git-Tag: v0.99.9k~3^2~26 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=545f229a4b43212e683ac63e5aa740324ac7799e;p=git.git 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 Signed-off-by: Junio C Hamano --- diff --git a/fsck-objects.c b/fsck-objects.c index 17d05363e..c1b279efc 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) {