Browse Source

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>
maint
Sergey Vlasov 20 years ago committed by Junio C Hamano
parent
commit
545f229a4b
  1. 7
      fsck-objects.c

7
fsck-objects.c

@ -184,10 +184,17 @@ static int fsck_tree(struct tree *item)
default: default:
break; break;
} }
free(last->name);
free(last);
} }


last = entry; last = entry;
} }
if (last) {
free(last->name);
free(last);
}
item->entries = NULL;


retval = 0; retval = 0;
if (has_full_path) { if (has_full_path) {

Loading…
Cancel
Save