Skip to content
0:00 / 0:00

#zig#memoryallocation#arenaallocator

What's a Memory Allocator Anyway? - Benjamin Feng

Zig SHOWTIME

17K subscribers • 45 videos on Hallway

YouTube
  • Recommended by 5 people: 3 on Hacker News, 1 on Lobsters and 1 in engineering communities.
  • Presented by Benjamin Feng, Zig contributor

Intermediate. Assumes working knowledge.

89K views6 years ago5 recommendations

Systems programmingProgramming languagesZigMemory managementPerformance and optimization

Benjamin Feng explains the fundamentals of memory allocators, exploring different allocation strategies and how they are implemented in Zig.

From Zig SHOWTIME #5 zig.show Title Talk Interview

Why it's here

5 people recommend this

What people say. Recommended as an excellent, accessible overview of single-threaded memory allocation strategies and Zig's unique approach to memory management.

u/gary_oldman_sachsin r/Zig • Recommends

What's a Memory Allocator Anyway? - Benjamin Feng

dbremneron Lobsters • Recommends

What's a Memory Allocator Anyway? (2020)

snicker7on Hacker News • Recommends

On “Custom Allocators Demystified”

Would recommend watching the "What's a Memory Allocator, Anyway?" talk from Zig contributor Benjamin Feng: link to this video

Rendelloon Hacker News • Recommends

On “The effect of switching to TCMalloc on RocksDB memory use”

It's interesting that I saw this post minutes after watching the talk "What's a Memory Allocator Anyway?" by Benjamin Feng. It's ostensibly about Zig's allocation schemes, but it's more of a general overview of the varied (single-thread) allocation strategies in use today. It made me really want to try out arena allocators It's a quick watch at 1.5x speed, the last third is an interview. 1. link to this video

kristoff_iton Hacker News • Recommends

On “Drop millions of allocations by using a linked list (2015)”

For an overview of how Zig does this and at the same time a nice overview on different types of allocators: What's a Memory Allocator Anyway? by Benjamin Feng link to this video

u/punkbertin r/Zig • Mentions

On “What is a allocator anyway?”

Here's a talk by Benjamin Feng titled What's a Memory Allocator Anyway?

u/jackdbdin r/Zig • Mentions

On “What book can you recommend to learn zig?”

…For example: * bump allocator * bump allocator with expandable memory (aka arena allocator) * testing allocator (very useful when you are writing tests because it will scream at you when your code has memory leaks) Maybe write some tests that allocate some memory to see how to use them. And of course watch this excellent talk by Benjamin Feng: [video This talk about memory allocation by Jorge Rodriguez is also great: [video Also, you'll need to understand the different types of **pointers** in Zig, so have a look at Solving Common Pointer Conundrums by Loris Cro: [video As for some materials on stack, heap, etc, try googling something like "memory layout of a C program". I woul…

u/qualia-assurancein r/C_Programming • Mentions

On “Using pointers to be gentler to RAM”

…case you want to start reading the source of such things. C is an obvious starting point. But if you're after learning about more modern allocation strategies then there's been quite a few things added to C++ over the last decade regarding allocators. And Zig has some really good stuff in the works. This talk is a good place to get up to speed. [video The alternative is that you push through the user space mirror and make your way in to wonderland - something I haven't done myself so I can only parrot hearsay. But Understanding the Linux Kernel and Linux Kernel Development are two popular books mentioned in such discussions. These cover a lot of the details behind how the Kernel request…

u/Avyakta18in r/Zig • Mentions

On “Love at first sight”

For me https://ziglearn.org/chapter-2/#allocators was enough to know allocators and how to use them. Also have a look at What's a Memory Allocator Anyway? - Benjamin Feng - YouTube . I love this video!

u/your_sweetpeain r/ProgrammingLanguages • Mentions

On “Books to better understand memory allocation.”

I don't have a book recommendation, but I recommend taking a look at the video What's a Memory Allocator Anyway?. It's Zig-focused since Zig has you pass around an allocator specifically, but it's a great foundation for thinking about allocation in general IMO.

u/guilhermeg2kin r/Zig • Mentions

On “what's the difference between the different memory allocators in zig? And which one should I use in different cases?”

A more deep explanation link to this video

u/kayroozein r/Zig • Mentions

On “My first Zig library - Seeking feedback”

You should use an arena allocator instead of a general purpose allocator for most use cases in this type of work. It's essentially just an array where you allocate by moving the pointer up then dropping the entire thing at the end of the process. GPAs aren't usually where major performance bottle necks are, but getting rid of them is an easy performance win. [video

u/kayroozein r/Zig • Mentions

On “How can I experience all that Zig, and low-level programming have to offer?”

…entality. Your ability to find and learn these things is a skill in and of itself. You want to read through the information, try to implement it after which you’ll have a better idea of what they do, then ask questions or if you’re stuck for too long ask questions. Here are some good videos to get you thinking about memory management strategies. link to this video link to this video And here’s a good resource for understanding how code runs on the hardware https://www.computerenhance.com/ And here’s a good discussion to understand language design link to this video If you want some project ideas to learn, anything with a Game API tends to work out pretty well and they’re usually free, and crypto trading projects ten…

u/alvarez_tomasin r/C_Programming • Mentions

On “Any way to allocate chunks of memory and use slices?”

link to this video This is a Zig-related talk but is a nice introduction to arena allocators (among others)