aboutsummaryrefslogtreecommitdiff
path: root/builtin-rev-list.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@osdl.org>2006-06-17 18:47:58 -0700
committerJunio C Hamano <junkio@cox.net>2006-06-17 18:49:52 -0700
commitcb115748ec0d4c6faccd09f3637ea436482dd7d5 (patch)
treebb38fb8ed8b3e52e3670fc9094e5463a7dd6f3a1 /builtin-rev-list.c
parentd3ff6f55012c939740ce0982b24aeb6fba3c6e4f (diff)
downloadgit-cb115748ec0d4c6faccd09f3637ea436482dd7d5.tar.gz
git-cb115748ec0d4c6faccd09f3637ea436482dd7d5.tar.xz
Some more memory leak avoidance
This is really the dregs of my effort to not waste memory in git-rev-list, and makes barely one percent of a difference in the memory footprint, but hey, it's also a pretty small patch. It discards the parent lists and the commit buffer after the commit has been shown by git-rev-list (and "git log" - which already did the commit buffer part), and frees the commit list entry that was used by the revision walker. The big win would be to get rid of the "refs" pointer in the object structure (another 5%), because it's only used by fsck. That would require some pretty major surgery to fsck, though, so I'm timid and did the less interesting but much easier part instead. This (percentually) makes a bigger difference to "git log" and friends, since those are walking _just_ commits, and thus the list entries tend to be a bigger percentage of the memory use. But the "list all objects" case does improve too. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-rev-list.c')
-rw-r--r--builtin-rev-list.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index 2b298c4e4..71353eb19 100644
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
@@ -89,6 +89,14 @@ static void show_commit(struct commit *commit)
printf("%s%c", pretty_header, hdr_termination);
}
fflush(stdout);
+ if (commit->parents) {
+ free_commit_list(commit->parents);
+ commit->parents = NULL;
+ }
+ if (commit->buffer) {
+ free(commit->buffer);
+ commit->buffer = NULL;
+ }
}
static struct object_list **process_blob(struct blob *blob,