This paper is a very nice overview of how the Linux kernel allocates memory: halobates.de/memorywaste.pdf

To summarise it asks the BIOS for memory and manually allocates out of until it can set up a simple "bootmem" allocator. Once it's finished allocator it transitions that to a "page allocator", which in turn backs various "slab allocators" and userspace allocators.

Memory is typically freed on demand, and "mempools" ensure there's enough available for *critical* operations like swapping pages.

Follow

@alcinnz interesting :)

I never thought about memory allocation much, until a few months back, when I read another pretty good article but from a higher level programming perspective.

It starts out about how ruby memory allocation may be unnecessarily wasteful but actually ends up explaining a lot about how multiple different memory allocators interact.

Might be of interest to programmers who never "need" to think about memory allocation.
joyfulbikeshedding.com/blog/20

Sign in to participate in the conversation
Librem Social

Librem Social is an opt-in public network. Messages are shared under Creative Commons BY-SA 4.0 license terms. Policy.

Stay safe. Please abide by our code of conduct.

(Source code)

image/svg+xml Librem Chat image/svg+xml