News for hackers. Stuff that matters.
Re:The history of Unix's confusing set of low-level ways to ... by jeffbee on Tuesday November 02, 2021 @11:25PM (#29090794)
The old, original tcmalloc that is still widely used starts out using sbrk and only switches to mmap if it exhausts the heap. So if you trace a program using gperftools/tcmalloc you could expect to see plenty of sbrk.

(The newer hugepage-aware tcmalloc never uses sbrk.)

Re:The history of Unix's confusing set of low-level ways to ... by pchanda on Wednesday November 03, 2021 @12:25AM (#29091095)
What do you mean when you say it exhausts the heap? I understand that the stack size is fixed but can't the heap grow unbounded using sbrk till it exhausts the address space?
Re:The history of Unix's confusing set of low-level ways to ... by Taniwha on Wednesday November 03, 2021 @01:18AM (#29091332)
I think they mean that it grows to the point where it collides with the virtual address space allocated to another block (the stack, a shared library, a mmap'd area etc)
Re:The history of Unix's confusing set of low-level ways to ... by guerrilla on Wednesday November 03, 2021 @12:33AM (#29091127)
I don't know anything aboug tcmalloc specifically but if the program is not mapped at 0, then there's space below it as well. The heap can meet the stack using sbrk while memory below where the program is could still be mmapped. This was the case on x86-32 anyway. On x86-64 programs are mapped much lower (on my system anyway.)