Listing 2. A smaller trim threshold might save space.
branzo@betelgeuse:~/malloc_debug$ ./Listing_1 128
Allocating 100k, trim threshhold is set to 131072
Arena 0:
system bytes = 103724
in use bytes = 100012
Total (incl. mmap):
system bytes = 103724
in use bytes = 100012
max mmap regions = 0
max mmap bytes = 0
Now freeing 100k
Arena 0:
system bytes = 103724
in use bytes = 4
Total (incl. mmap):
system bytes = 103724
in use bytes = 4
max mmap regions = 0
max mmap bytes = 0
branzo@betelgeuse:~/malloc_debug$ ./Listing_1 64
Allocating 100k, trim threshhold is set to 65536
Arena 0:
system bytes = 103724
in use bytes = 100012
Total (incl. mmap):
system bytes = 103724
in use bytes = 100012
max mmap regions = 0
max mmap bytes = 0
Now freeing 100k
Arena 0:
system bytes = 1324
in use bytes = 4
Total (incl. mmap):
system bytes = 1324
in use bytes = 4
max mmap regions = 0
max mmap bytes = 0
Copyright © 1994 - 2019 Linux Journal. All rights reserved.