My understanding of the way that malloc() and free() work is that they operate on a global compile-time memory pool (which we call the heap) allocated by their library implementation. I am not sure how to track whether malloc() invokes a system call to "extend the size of the heap" from OS, or just declares failure.
What system call would it invoke for Linux?
How would the OS guarantee that the requested heap block is contiguous with whatever heap was allocated initially?
My understanding of the way that
malloc()
andfree()
work is that they operate on a global compile-time memory pool (which we call the heap) allocated by their library implementation. I am not sure how to track whethermalloc()
invokes a system call to "extend the size of the heap" from OS, or just declares failure.What system call would it invoke for Linux?
How would the OS guarantee that the requested heap block is contiguous with whatever heap was allocated initially?