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