
Show HN: Tiny C runtime Linux (rt0), HelloWorld 0.6k (i386), sbrk example added - oso2k
https://github.com/lpsantil/rt0/blob/65b4d966409ee24ddae0d4915368542537035c81/STATS.md
======
oso2k
Original HN announcement/discussion
[[https://news.ycombinator.com/item?id=8974024](https://news.ycombinator.com/item?id=8974024)].
CFLAGS additions produce smaller binaries. HelloWorld in 608 bytes (i386) and
792 bytes (x86_64). An example of sbrk/brk provided in the test folder.

------
duaneb
What is sbrk even used for anymore? Surely most heap allocators use
mmap/mprotect directly these days. There's no downside.

EDIT: Not trying to rain on anyone's parade, I think the syscall mentioned is
beside the point of the post. :)

~~~
koenigdavidmj
sbrk competes with mmap, not mprotect.

And yes, I would expect mmap to be used in most modern systems. OS X, for
instance, just emulates sbrk with a large static buffer, and it has no actual
effect on the page tables.

~~~
oso2k
4MB buffer to be exact [0].

[0]
[https://books.google.com/books?id=K8vUkpOXhN4C&pg=PA950&lpg=...](https://books.google.com/books?id=K8vUkpOXhN4C&pg=PA950&lpg=PA950&dq=osx+srbk+4mb&source=bl&ots=OLljV-
UpVu&sig=n0NaVzZMEBKMk6FPZAsoOPF6JLo&hl=en&sa=X&ved=0CCgQ6AEwAWoVChMIxJOc7Yy-
yAIVzlqICh0v-gov#v=onepage&q=osx%20srbk%204mb&f=false)

