I have a program where it makes sense for me to allocate my own heap, as I have a certain read operation that could take some indeterminate amount of space that I need to store into memory contiguously for ease of ease. I understand that libc
sets up the heap for malloc
and friends, and that calling sbrk
and brk
could mess with that. I don't intend to use malloc
or the heap otherwise in my program.
Put simply, I want to have a "heap"-like area of memory, where I can request the operating system to grow it as needed, and it is not backed by the file system.
Even if only for learning purposes, how can I:
- prevent heap set-up by
libc
- set up my own heap
- extend it properly using
sbrk
andbrk