Skip to content

Commit

Permalink
Merge branch 'jk/maint-break-rename-reduce-memory'
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Junio C Hamano committed Nov 23, 2009
2 parents 82f05d5 + 809809b commit a1b01c4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 5 additions & 1 deletion diffcore-break.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
7 changes: 5 additions & 2 deletions diffcore-rename.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}

Expand Down

0 comments on commit a1b01c4

Please sign in to comment.