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>
Nguyễn Thái Ngọc Duy committed
Dec 6, 2016 at 19:53 UTC
6bc3d8c5ec04cdfaa7dc14aed1993f3bb376d9ae
1 file changed
+4
-2
shallow.c
+4
-2
@@ -353,6 +353,8 @@ void remove_nonexistent_theirs_shallow(struct shallow_info *info)
353
354
define_commit_slab(ref_bitmap, uint32_t *);
355
356
+#define POOL_SIZE (512 * 1024)
357
+
358
struct paint_info {
359
struct ref_bitmap ref_bitmap;
360
unsigned nr_bits;
@@ -369,9 +371,9 @@ static uint32_t *paint_alloc(struct paint_info *info)
371
if (!info->pool_count || info->free + size > info->end) {
372
info->pool_count++;
373
REALLOC_ARRAY(info->pools, info->pool_count);
372
- info->free = xmalloc(COMMIT_SLAB_SIZE);
374
+ info->free = xmalloc(POOL_SIZE);
375
info->pools[info->pool_count - 1] = info->free;
374
- info->end = info->free + COMMIT_SLAB_SIZE;
376
+ info->end = info->free + POOL_SIZE;
377
}
378
p = info->free;
379
info->free += size;