Commits

Junio C Hamano  committed a1b01c4 Merge

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

  • Participants
  • Parent commits 82f05d5, 809809b

Comments (0)

Files changed (2)

File diffcore-break.c

 		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;
 				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);

File diffcore-rename.c

 			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++;
 	}