@matheusbsbs / matheus-bagliano / commits / f4f19fb634
Fork 0

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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Nov 16, 2009 at 10:56 UTC f4f19fb63449e1beee02b0ec845319f7115fa9d0
1 file changed +4
diffcore-break.c
+4
@@ -204,12 +204,16 @@ void diffcore_break(int break_score)
204 dp->score = score;
205 dp->broken_pair = 1;
206
207 + diff_free_filespec_data(p->one);
208 + diff_free_filespec_data(p->two);
209 free(p); /* not diff_free_filepair(), we are
210 * reusing one and two here.
211 */
212 continue;
213 }
214 }
215 + diff_free_filespec_data(p->one);
216 + diff_free_filespec_data(p->two);
217 diff_q(&outq, p);
218 }
219 free(q->queue);