How is space from malloc allocated?
malloc is a library function that makes use the sbrk system call. The manual page of malloc on Linux says:


  Normally,  malloc() allocates memory from the heap, and adjusts the size of the heap as required, using sbrk(2).


If we now look at sbrk manual page:


   brk() and sbrk() change the location of the  program  break,
   which  defines  the end of the process's data segment (i.e.,
   the program break is the first location after the end of the
   uninitialized  data  segment).  Increasing the program break
   has the effect of allocating memory to the process; decreas
   ing the break deallocates memory.