O'Reilly logo

Hands-On System Programming with Linux by Kaiwan N Billimoria

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Scenario 3 – large allocations option

This time, we pass the 2 parameter, asking the program to perform larger allocations (greater than MMAP_THRESHOLD):

$ ./malloc_brk_test 2                              init_brk =        0x2209000 #: malloc(       n) =        heap_ptr           cur_brk   delta                                                       [cur_brk-init_brk][...] 3: malloc(  136168) =   0x7f57288cd010         0x222a000 [135168]Arena 0:system bytes     =     135168in use bytes     =       5792Total (incl. mmap):system bytes     =     274432in use bytes     =     145056max mmap regions =          1max mmap bytes   =     139264 4: malloc( 1048576) =   0x7f57287c7010         0x222a000 [135168]Arena 0:system bytes     =     135168in use bytes     =       5792Total (incl. mmap):system bytes     =    1327104in use bytes     =    1197728max mmap regions =          2max mmap bytes   =    1191936$                     

(Note that the preceding code we have clipped the output of the first ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required