Skip to content

Commit

Permalink
git-fsck-objects: Free tree entries after use
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sergey Vlasov authored and Junio C Hamano committed Nov 15, 2005
1 parent a52e4ef commit 545f229
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions fsck-objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 545f229

Please sign in to comment.