Maintained by: NLnet Labs

Remove code that relies on sbrk()

Dag-Erling Smørgrav
Fri Nov 18 12:39:01 CET 2016


Unbound pretends to report memory statistics based on the value returned
by sbrk().  Not only is this non-portable (as demonstrated by r3528 and
r3911), but it is completely meaningless even on systems that provide
the sbrk() function.  First, modern allocators (and by "modern" I mean
"anything written in the last 10-15 years") use mmap(), not sbrk(), to
manage address space.  Second, even with allocators that do rely on
sbrk(), it only tells you how much address space is available to the
program, not how much of it is currently or has ever been used.  The
attached patch removes all traces of sbrk() from the code.

DES
-- 
Dag-Erling Smørgrav - des at des.no

-------------- next part --------------
A non-text attachment was scrubbed...
Name: unbound-sbrk.diff
Type: text/x-patch
Size: 7412 bytes
Desc: not available
URL: <https://unbound.nlnetlabs.nl/pipermail/unbound-users/attachments/20161118/02af0fc9/attachment.bin>