Why does malloc() call mmap() and brk() interchangeably?
I'm new to C and heap memory, still struggling to understand dynamic memory allocation. I traced Linux system calls and found that if I use malloc to request a small amount of heap memory, then malloc calls brk internally. But if I use malloc to request a very large amount of heap memory, then malloc calls mmap internally. So there must be a big difference b