| ▲ | Show HN: I wrote a minimal memory allocator in C(github.com) | |||||||
| 42 points by t9nzin 4 hours ago | 3 comments | ||||||||
A fun toy memory allocator (not thread safe, that's a future TODO). I also wanted to explain how I approached it, so I also wrote a tutorial blog post (~20 minute read) covering the code which you can find the link to in the README. | ||||||||
| ▲ | achierius an hour ago | parent | next [-] | |||||||
Looks nice! Though I have to say, you should probably avoid sbreak even for small allocations -- obviously it's slow, but even beyond that you have to deal with the fact that it's essentially a global singleton and introduces a lot of subtle failure cases you might not think of + which you can't really solve anyways. It's better to mmap out some chunk of memory and sub-allocate it out yourself. | ||||||||
| ||||||||
| ▲ | quibono an hour ago | parent | prev [-] | |||||||
I hate that very often my first reaction to Show HN posts like this is to cynically look for signs of blatant AI code use. I don't think that's the case here though. | ||||||||