summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2009-11-22 16:28:23 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2009-11-22 16:28:23 -0800
commita1b01c45d58bba35ec1c2533dfb8d87cfa08b19e (patch)
tree648414277bdb09c79e05bcf2a938a97225db598a
parentMerge branch 'tc/format-attribute' (diff)
parentdiffcore-rename: reduce memory footprint by freeing blob data early (diff)
downloadtgif-a1b01c45d58bba35ec1c2533dfb8d87cfa08b19e.tar.xz
Merge branch 'jk/maint-break-rename-reduce-memory'
* jk/maint-break-rename-reduce-memory: diffcore-rename: reduce memory footprint by freeing blob data early diffcore-break: save cnt_data for other phases diffcore-break: free filespec data as we go
-rw-r--r--diffcore-break.c6
-rw-r--r--diffcore-rename.c7
2 files changed, 10 insertions, 3 deletions
diff --git a/diffcore-break.c b/diffcore-break.c
index d7097bb576..3a7b60a037 100644
--- a/diffcore-break.c
+++ b/diffcore-break.c
@@ -69,7 +69,7 @@ static int should_break(struct diff_filespec *src,
return 0; /* we do not break too small filepair */
if (diffcore_count_changes(src, dst,
- NULL, NULL,
+ &src->cnt_data, &dst->cnt_data,
0,
&src_copied, &literal_added))
return 0;
@@ -204,12 +204,16 @@ void diffcore_break(int break_score)
dp->score = score;
dp->broken_pair = 1;
+ diff_free_filespec_blob(p->one);
+ diff_free_filespec_blob(p->two);
free(p); /* not diff_free_filepair(), we are
* reusing one and two here.
*/
continue;
}
}
+ diff_free_filespec_data(p->one);
+ diff_free_filespec_data(p->two);
diff_q(&outq, p);
}
free(q->queue);
diff --git a/diffcore-rename.c b/diffcore-rename.c
index 63ac998bfa..d6fd3cacd6 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++;
}