Skip to content

Commit

Permalink
diffcore-break: free filespec data as we go
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
peff authored and gitster committed Nov 16, 2009
1 parent 78d553b commit f4f19fb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions diffcore-break.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
continue;
}
}
diff_free_filespec_data(p->one);
diff_free_filespec_data(p->two);
diff_q(&outq, p);
}
free(q->queue);
Expand Down

0 comments on commit f4f19fb

Please sign in to comment.