Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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>
  • Loading branch information...
commit 545f229a4b43212e683ac63e5aa740324ac7799e 1 parent a52e4ef
@sigprof sigprof authored Junio C Hamano committed
Showing with 7 additions and 0 deletions.
  1. +7 −0 fsck-objects.c
View
7 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) {
Please sign in to comment.
Something went wrong with that request. Please try again.