Python Memory Management and Tips Transcripts
Chapter: Welcome to the course
Lecture: Topics covered

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Let's talk about what we're gonna cover in this course. We're certainly going to talk about
0:05 Python memory management. But there's actually three distinct and useful things we're gonna
0:10 cover here. So, three separate chapters. We're going to talk about how Python works with
0:14 variables and look behind the scenes in the CPython source code to see what's really
0:19 going on when we work with things like strings or dictionaries or whatever.
0:24 We'll get a much better understanding of the structures that Python itself has to work with
0:29 which will be important for the rest of the discussion around memory management. We're also going to talk about allocation.
0:36 People often think memory management, clean up. You know, garbage collection, reference kind of and so on. And yes, we'll talk about those things,
0:42 but Python actually does really interesting things around allocation and a bunch of cool design patterns
0:48 and data structures and techniques to make allocating memory much more efficient,
0:53 which then lead into making reference counting more efficient as well as garbage collection. So Python has two ways to clean up memory.
1:00 We're gonna talk about them both, when either of them come into action. We'll also write a lot of code to
1:06 explore that. The data structures that you choose to represent your data and your application can dramatically vary in how much memory they use.
1:15 We're gonna take the same data and look at it through the lens of storing it in a bunch of different types of data structures:
1:21 arrays, lists, dictionaries, classes, even pandas data frames and NumPy arrays and see what the various trade-offs
1:29 are around these different data structures. Once we get to talking about functions,
1:34 you'll see that there are some really powerful and simple design patterns that can dramatically make our code faster and more memory efficient.
1:43 So we're gonna look at some really cool ways to make our functions use a little less or a lot less of the memory that we're using.
1:51 We're also gonna look at classes because storing data in classes is super important in Python and maybe gonna create a list of classes,
1:58 a whole bunch of them and so on, and you can have a lot of data there. So we're going to talk about different techniques we can use
2:04 when we're designing classes in Python to make it much more efficient both in memory and it turns out a nice little consequence in speed as well.
2:14 Finally, we're going to do some detective work. Once we understand all of these things we're going to take a script and we're just
2:19 going to run it through some cool tools. Try to understand from the outside what exactly is happening in our application.
2:28 How Python is using memory. We're gonna create some interactive web views of this data. We're actually gonna create some graphs,
2:34 all kinds of stuff. So we're gonna use some really neat tools to do the detective
2:38 work, to understand how our program is working and where we should apply some of
2:42 these techniques that we've learned previously that make it even better and faster. That's what we're gonna cover. It's gonna be a lot of fun.
2:49 It's gonna be hands on, but also some high level conversations. I think you'll get a lot out of it, and I'm looking forward to sharing it with you.

Talk Python's Mastodon Michael Kennedy's Mastodon