summaryrefslogtreecommitdiff
path: root/crt/crtn.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2020-06-10 19:41:27 -0400
committerRich Felker <dalias@aerifal.cx>2020-06-10 20:34:34 -0400
commit28f64fa6caeb621780bf116bc8cae7d7a48b477e (patch)
treef0ac98c4c7f415fb704ddeea84310be8f3317ec3 /crt/crtn.c
parent384c0131ccda2656dec23a0416ad3f14101151a7 (diff)
downloadmusl-28f64fa6caeb621780bf116bc8cae7d7a48b477e.tar.gz
musl-28f64fa6caeb621780bf116bc8cae7d7a48b477e.tar.bz2
musl-28f64fa6caeb621780bf116bc8cae7d7a48b477e.tar.xz
musl-28f64fa6caeb621780bf116bc8cae7d7a48b477e.zip
switch to a common calloc implementation
abstractly, calloc is completely malloc-implementation-independent; it's malloc followed by memset, or as we do it, a "conditional memset" that avoids touching fresh zero pages. previously, calloc was kept separate for the bump allocator, which can always skip memset, and the version of calloc provided with the full malloc conditionally skipped the clearing for large direct-mmapped allocations. the latter is a moderately attractive optimization, and can be added back if needed. however, further consideration to make it correct under malloc replacement would be needed. commit b4b1e10364c8737a632be61582e05a8d3acf5690 documented the contract for malloc replacement as allowing omission of calloc, and indeed that worked for dynamic linking, but for static linking it was possible to get the non-clearing definition from the bump allocator; if not for that, it would have been a link error trying to pull in malloc.o. the conditional-clearing code for the new common calloc is taken from mal0_clear in oldmalloc, but drops the need to access actual page size and just uses a fixed value of 4096. this avoids potentially needing access to global data for the sake of an optimization that at best marginally helps archs with offensively-large page sizes.
Diffstat (limited to 'crt/crtn.c')
0 files changed, 0 insertions, 0 deletions