summaryrefslogtreecommitdiff
path: root/builtin/fsck.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-07-03 16:51:57 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-07-04 22:26:03 (GMT)
commit781d93067d3ab8b448a4c8989a6e3cac17009061 (patch)
tree9c6761d76dcfb971581ffcf2f8790a0246b66f79 /builtin/fsck.c
parentc6458e60ed0f3e26a1df88bf5a3da8b091b0ce15 (diff)
downloadgit-781d93067d3ab8b448a4c8989a6e3cac17009061.zip
git-781d93067d3ab8b448a4c8989a6e3cac17009061.tar.gz
git-781d93067d3ab8b448a4c8989a6e3cac17009061.tar.bz2
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 'builtin/fsck.c')
0 files changed, 0 insertions, 0 deletions