A good memory allocator in 200 lines of code
https://github.com/ziglang/zig/blob/0.14.0/lib/std/heap/SmpAllocator.zigHi Lobsters,
I know people here may be tired of seeing too many Zig stories, but, I think this is a legitimately cool discovery that transcends programming language turf wars.
This is a memory allocator that outcompetes glibc malloc with an incredibly simple implementation, that can be read and understood in a matter of minutes, even if you have never used the programming language it is written in, even if this is your first time considering a memory allocator implementation.
I am the author of this code, which is fairly new and not yet battle-tested. Maybe I’m missing something crucial, or maybe it’s going to become a specimen for computer science students to learn about memory allocation from. Either way, I hope you will find it interesting and on-topic here.
I added the “zig” tag out of courtesy, but it’s really not the point of the story, the point is that it’s possible to implement a good memory allocator that is also conceptually simple.
-Andrew
Is it true what they say: "Lobsters love Guinness"?
https://postimg.cc/phdVNwPzFound in an Irish Pub in Barcelona.