rdssonawane
rdssonawane

Reputation: 125

Impact of Increasing GLIBC malloc() M_MMAP_THRESHOLD to 1GB

I am using glibc (version 2.21) for system with page size (2MB and 64MB). But with this very large page size, there is more fragmentation. So i increased the M_MMAP_THRESHOLD to 32MB using mallopt() still there is fragmentation. So i want to increase M_MMAP_THRESHOLD to 1 GB. Is there any impact of this on bin index calculation ?

Upvotes: 3

Views: 1173

Answers (1)

Florian Weimer
Florian Weimer

Reputation: 33747

This question was answered on the libc-help list:

If you increase M_MMAP_THRESHOLD, you also have to increase the heap size to something like 32 GiB (HEAP_MAX_SIZE in malloc/arena.c). The default of 2 * DEFAULT_MMAP_THRESHOLD_MAX is probably too small (assuming that DEFAULT_MMAP_THRESHOLD_MAX will be 2 GiB). Otherwise you will have substantial fragmentation for allocation requests between 2 GiB and HEAP_MAX_SIZE.

Upvotes: 3

Related Questions