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>
Sergey Vlasov committed
Nov 15, 2005 at 19:07 UTC
545f229a4b43212e683ac63e5aa740324ac7799e
1 file changed
+7
fsck-objects.c
+7
@@ -184,10 +184,17 @@ static int fsck_tree(struct tree *item)
184
default:
185
break;
186
}
187
+ free(last->name);
188
+ free(last);
189
}
190
191
last = entry;
192
}
193
+ if (last) {
194
+ free(last->name);
195
+ free(last);
196
+ }
197
+ item->entries = NULL;
198
199
retval = 0;
200
if (has_full_path) {