summaryrefslogtreecommitdiff
path: root/notes-utils.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2015-07-03 09:51:57 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2015-07-04 15:26:03 -0700
commit781d93067d3ab8b448a4c8989a6e3cac17009061 (patch)
tree9c6761d76dcfb971581ffcf2f8790a0246b66f79 /notes-utils.c
parentindex-pack: kill union delta_base to save memory (diff)
downloadtgif-781d93067d3ab8b448a4c8989a6e3cac17009061.tar.xz
index-pack: fix allocation of sorted_by_pos array
When c6458e60 (index-pack: kill union delta_base to save memory, 2015-04-18) attempted to reduce the memory footprint of index-pack, one of the key thing it did was to keep track of ref-deltas and ofs-deltas separately. In fix_unresolved_deltas(), however it forgot that it now wants to look only at ref deltas in one place. The code allocated an array for nr_unresolved, which is sum of number of ref- and ofs-deltas minus nr_resolved, which may be larger or smaller than the number ref-deltas. Depending on nr_resolved, this was either under or over allocating. Also, the old code before this change had to use 'i' and 'n' because some of the things we see in the (old) deltas[] array we scanned with 'i' would not make it into the sorted_by_pos[] array in the old world order, but now because you have only ref delta in a separate ref_deltas[] array, they increment lock&step. We no longer need separate variables. And most importantly, we shouldn't pass the nr_unresolved parameter, as this number does not play a role in the working of this helper function. Helped-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'notes-utils.c')
0 files changed, 0 insertions, 0 deletions