How/where is sbrk used within malloc.c?

Viewed 2205

I have read in Advanced Unix Programming (and also in a few other books) that Linux malloc() uses the Linux system call sbrk() to request memory from the operating system.

I am looking at the glibc malloc.c code and I can see many mentions of sbrk() in the comments, but not referred to directly in the code.

How/where is sbrk() referred to/used when malloc() requests memory from the OS?

(This could be a general misunderstanding on my part of how system calls are made from the C runtime library. If so, I would be interested to know how they are made??)

1 Answers
Related