Process Heap


The heap is an area of memory that is managed by the process for on the fly memory allocation.

This is for variables whose memory requirements are not known at compile time.

  • brk
    • The bottom of the heap is known as the brk, so called for the system call which modifies it.
    • By using the brk call to grow the area downward the process can request the kernel allocate more for it to use.
  • malloc
    • The heap is mostly managed by the malloc library call.
    • This makes managing the heap for programmer by allowing them to simply allocate and free (via the free call) heap memory.
    • Malloc can use schemes like a buddy allocator to manage the heap memory for the user.
    • Malloc can also be smarter about allocation and potentially use anonymous mmaps for extra process memory.
    • This is where instead of mmaping a file into the process memory, it directly maps an area of system RAM.

Leave a Reply