summaryrefslogtreecommitdiff
path: root/shallow.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2016-12-06 12:53:35 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-12-07 23:44:31 (GMT)
commit6bc3d8c5ec04cdfaa7dc14aed1993f3bb376d9ae (patch)
tree4da7c74be968ab485c59782780d7786f5f21ef9c /shallow.c
parent0afd307ab403404f7cf775fc5042f527e8289980 (diff)
downloadgit-6bc3d8c5ec04cdfaa7dc14aed1993f3bb376d9ae.zip
git-6bc3d8c5ec04cdfaa7dc14aed1993f3bb376d9ae.tar.gz
git-6bc3d8c5ec04cdfaa7dc14aed1993f3bb376d9ae.tar.bz2
shallow.c: stop abusing COMMIT_SLAB_SIZE for paint_info's memory pools
We need to allocate a "big" block of memory in paint_alloc(). The exact size does not really matter. But the pool size has no relation with commit-slab. Stop using that macro here. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'shallow.c')
-rw-r--r--shallow.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/shallow.c b/shallow.c
index 57b5fc7..91aa59d 100644
--- a/shallow.c
+++ b/shallow.c
@@ -353,6 +353,8 @@ void remove_nonexistent_theirs_shallow(struct shallow_info *info)
define_commit_slab(ref_bitmap, uint32_t *);
+#define POOL_SIZE (512 * 1024)
+
struct paint_info {
struct ref_bitmap ref_bitmap;
unsigned nr_bits;
@@ -369,9 +371,9 @@ static uint32_t *paint_alloc(struct paint_info *info)
if (!info->pool_count || info->free + size > info->end) {
info->pool_count++;
REALLOC_ARRAY(info->pools, info->pool_count);
- info->free = xmalloc(COMMIT_SLAB_SIZE);
+ info->free = xmalloc(POOL_SIZE);
info->pools[info->pool_count - 1] = info->free;
- info->end = info->free + COMMIT_SLAB_SIZE;
+ info->end = info->free + POOL_SIZE;
}
p = info->free;
info->free += size;