Python Memory Management and Tips Transcripts
Chapter: Allocating memory in Python
Lecture: Allocation introduction
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
When you think about Python memory management,
0:02
you're very likely thinking about reference counting, garbage collection,
0:06
how things get cleaned up. But memory doesn't start there.
0:10
It starts by getting allocated, and it turns out that Python has a whole bunch
0:15
of techniques and patterns and ideas around
0:19
making allocation fast, efficient, doing things
0:23
so there's not memory fragmentation, all of those kinds of things.
0:28
Allocation in Python is actually way more interesting than you would think.
0:33
So we're going to spend some time talking about the core algorithm,
0:36
using pools and blocks and arenas,
0:40
which maybe you've never heard of,
0:41
but all of these things are really important in working with objects to prevent memory fragmentation
0:47
and prevent them from blowing up in terms of taking too much memory and so on.
0:51
So this will be really a fun and important prerequisite before we get to what most
0:56
people think when they think of python memory, and that's the
0:58
cleaning up side of all that.