summaryrefslogtreecommitdiff
path: root/diffcore-rename.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-11-21 06:13:47 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-11-21 06:13:47 (GMT)
commit809809bb75e8a65ef543ab706aab4791459be95c (patch)
tree0c31f2f311e7d4db373ca28336a2aa4beb8fc95d /diffcore-rename.c
parent8282de94bc76360e0bf76da4076755696b049d23 (diff)
downloadgit-809809bb75e8a65ef543ab706aab4791459be95c.zip
git-809809bb75e8a65ef543ab706aab4791459be95c.tar.gz
git-809809bb75e8a65ef543ab706aab4791459be95c.tar.bz2
diffcore-rename: reduce memory footprint by freeing blob data early
After running one round of estimate_similarity(), filespecs on either side will have populated their cnt_data fields, and we do not need the blob text anymore. We used to retain the blob data to optimize for smaller projects (not freeing the blob data here would mean that the final output phase would not have to re-read it), but we are efficient enough without such optimization for smaller projects anyway, and freeing memory early will help larger projects. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diffcore-rename.c')
-rw-r--r--diffcore-rename.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/diffcore-rename.c b/diffcore-rename.c
index 63ac998..d6fd3ca 100644
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
@@ -523,10 +523,13 @@ void diffcore_rename(struct diff_options *options)
this_src.dst = i;
this_src.src = j;
record_if_better(m, &this_src);
+ /*
+ * Once we run estimate_similarity,
+ * We do not need the text anymore.
+ */
diff_free_filespec_blob(one);
+ diff_free_filespec_blob(two);
}
- /* We do not need the text anymore */
- diff_free_filespec_blob(two);
dst_cnt++;
}