malloc is a library call. If he does not have memory in his own memory pool, he will ask the kernel to associate more memory with the process.
malloc for small buffers will use memory from its own pool, and free will return memory to this pool without releasing it to the system if the pool does not become too large.
malloc for large buffers is implemented in a completely different way, it will call the kernel and therefore will be slower, but when such a buffer is freed, it will be immediately freed.
http://linux.die.net/man/3/malloc
Read the notes there.
source share