Based on ptmalloc .
Heap Creation
Checking brk or malloc
- If parent thread, and memory wanted exceeds C Macro
DEFAULT_MMAP_THRESHOLD, then allocate with mmap() - Else, we setup with brk()
Setup with brk()
End_data: pointer that sets end of data segmentstart_brk: pointer that denotes beginning of heapBrk / program break: pointer that denotes end of heap segment- brk() used to initialize
end_datato the value specificied by addr start_brkset to next available segment after data segmentbrk = start_brk- To expand/shrink dimensions of heap, sbrk() is used

Setup with mmap()
we mmap() things at the Memory Map Segment
