Stack memory / automatic memory: allocations and deallocations are done implicitly(隐式地) by the compiler.
Heap memory: allocations and deallocations are done explicitly by programmer.
malloc() callDependency: stdlib.h
Usage: void *malloc(size_t size);
size: the number of bytes needed, usually calculated via sizeof().
Returns the pointer to allocated memory block.
Warning: sometimes if you use sizeof(some_pointer), it returns the size of the pointer instead of the size of the content.
free() callUsed for freeing heap memory no longer in use.
malloc() is based on brk() system call. It changes the location of the end of the heap.
mmap() creates an anonymous mem region in swap space.