3 ms·
I always like me some memory allocator blog/code. Two links in the context of gamedev below, in case you or anyone else is interested. https://screwjankgames.g
by canyp 11mo ago
I always like me some memory allocator blog/code. Two links in the context of gamedev below, in case you or anyone else is interested.
https://screwjankgames.github.io/engine%20programming/2020/09/24/writing-your-own-memory-allocators.html https://screwjankgames.github.io/engine%20programming/2020/0...
https://www.bytesbeneath.com/p/the-arena-custom-memory-allocators https://www.bytesbeneath.com/p/the-arena-custom-memory-alloc...
I also don't know how much we want to butcher this blog post, but:
> RAM is fundamentally a giant array of bytes, where each byte has a unique address. However, CPUs don’t fetch data one byte at a time. They read and write memory in fixed-size chunks called words which are typically 4 bytes on 32-bit systems or 8 bytes on 64-bit systems.
CPUs these days fetch entire cache lines. Memory is also split into banks. There are many more details involved, and it is viewing memory as a giant array of bytes that is fundamentally broken. It's a useful abstraction up until some point, but it breaks apart once you analyze performance. This part of the blog didn't seem very accurate.
- writebetterc 11mo agoIn a single-threaded context, I think 'giant array array of bytes' is still correct? Performance, not so much. > This part of the blog didn't seem very accurate. It was a sufficient amount of understanding to produce this allocator :-). I think that if we have beginner[0] projects posted and upvoted, we must understand that the author's understanding may be lacking some nuance. [0] author might be a very good programmer, just not familiar with this particular area!
- canyp 11mo agoI brought that up for their further reading since that part seemed to be the weakest part of the post. I think this is good work anyway.
- degamad 10mo ago> author might be a very good programmer, just not familiar with this particular area Or even, they may be familiar, but challenging their understanding or using simplifying assumptions to reduce complexity.