@matheusbsbs / matheus-bagliano / commits / 809809bb75
Fork 0

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>

Junio C Hamano committed Nov 20, 2009 at 22:13 UTC 809809bb75e8a65ef543ab706aab4791459be95c
1 file changed +5 -2
diffcore-rename.c
+5 -2
@@ -523,10 +523,13 @@ void diffcore_rename(struct diff_options *options)
523 this_src.dst = i;
524 this_src.src = j;
525 record_if_better(m, &this_src);
526 + /*
527 + * Once we run estimate_similarity,
528 + * We do not need the text anymore.
529 + */
530 diff_free_filespec_blob(one);
531 + diff_free_filespec_blob(two);
532 }
528 - /* We do not need the text anymore */
529 - diff_free_filespec_blob(two);
533 dst_cnt++;
534 }
535