Python Memory Management and Tips Transcripts
Chapter: Allocating memory in Python
Lecture: Allocation arenas

Login or purchase this course to watch this video and the rest of the course contents.
0:00 The last data structure or idea that we gotta cover when we think about how Python
0:04 is working with small objects are arenas. And arenas are 256 kilobytes of memory,
0:11 they're allocated on the heap and they manage 64 pools.
0:15 You can see down here the data structure that defines them.
0:18 It's quite similar to the pools.
0:20 You've got doubly linked list.
0:21 You've got the next free one.
0:23 Things like that. These arenas,
0:25 this is the top level thing.
0:26 Arenas contain a bunch of pools.
0:28 Arenas are always the same size.
0:30 The pools are often the same size,
0:33 the blocks that they contain, they might be different scale,
0:37 they might be 8 byte objects,
0:39 they might be 16 byte objects,
0:41 though, you know, the second would only hold half as many as before,
0:44 but that's the idea. We've got arenas that control the pools,
0:47 the pools hold the blocks, and the blocks are where the objects actually go
0:52 with 8 byte alignment.