path: root/diffcore-break.c
diff options
authorJeff King <>2009-11-16 15:56:25 (GMT)
committerJunio C Hamano <>2009-11-16 21:21:11 (GMT)
commitf4f19fb63449e1beee02b0ec845319f7115fa9d0 (patch)
treebf115c830576748b274877f040e477b6a9375fd8 /diffcore-break.c
parent78d553b7d7b269bb22ebd8b1198657c37484a3a0 (diff)
diffcore-break: free filespec data as we go
As we look at each changed file and consider breaking it, we load the blob data and make a decision about whether to break, which is independent of any other blobs that might have changed. However, we keep the data in memory while we consider breaking all of the other files. Which means that both versions of every file you are diffing are in memory at the same time. This patch instead frees the blob data as we finish with each file pair, leading to much lower memory usage. Signed-off-by: Jeff King <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'diffcore-break.c')
1 files changed, 4 insertions, 0 deletions
diff --git a/diffcore-break.c b/diffcore-break.c
index d7097bb..15562e4 100644
--- a/diffcore-break.c
+++ b/diffcore-break.c
@@ -204,12 +204,16 @@ void diffcore_break(int break_score)
dp->score = score;
dp->broken_pair = 1;
+ diff_free_filespec_data(p->one);
+ diff_free_filespec_data(p->two);
free(p); /* not diff_free_filepair(), we are
* reusing one and two here.
+ diff_free_filespec_data(p->one);
+ diff_free_filespec_data(p->two);
diff_q(&outq, p);