←back to thread

237 points ekr____ | 1 comments | | HN request time: 0.216s | source
Show context
sylware ◴[] No.42724824[source]
Avoid as much as you can the C standard lib allocator, go directly to mmap system call with your own allocator if you know you won't use CPU without a MMU.

If you write a library, let the user code install its own allocator.

replies(3): >>42725907 #>>42729438 #>>42743433 #
1. commandlinefan ◴[] No.42743433[source]
> go directly to mmap system call

TFA said that, too... IIRC (and based on a quick googling), mmap is for memory-mapping files into the virtual address space. I thought sbrk() was used for low-level adjustment of available memory and malloc was responsible for managing an allocation handed to it by the sbrk() call. Or has that fallen out of fashion since I last did low-level C programming?