Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set the default subtitles language in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Memory Management: A Book

Give Feedback

00:00 Memory management is the process of managing the memory available on a system. This is especially important on microcomputers, which may only have a few kilobytes of memory instead of the several gigabytes your computer probably has. If memory isn’t managed properly, your programs might crash and you might lose important data that you’re working with.

00:21 Imagine if your document just started randomly scrambling the letters you typed after you’ve typed them. And if your system runs out of memory, it may become unusable or unstable. Memory management is a critical job.

00:36 You can think of memory management on two levels. At one level, we have the operating system, which manages how much memory each running application or process can use.

00:48 This is one of the most important jobs for the OS—making sure that the memory assigned to your running web browser is not used, say, by your email client. At another level, we have memory management within Python itself.

01:03 Python makes sure that any programs you have running run safely and efficiently. It makes sure that memory assigned to one variable is not simultaneously used by another. Exactly how this happens is the focus of this course.

01:19 Memory is like an empty book intended for short stories. Eventually, different authors will come along and they’ll write in their own stories. Since they aren’t allowed to write over each other, they must be very careful about which pages they write in.

01:34 These authors are like the processes writing data—or stories—into our memory book. The memory manager decides where in the book each author is allowed to write.

01:46 This book is around for a really long time, so after a while some stories are no longer relevant. From time to time, the memory manager calls in his buddy the garbage collector to come along and erase old stories that nobody’s reading.

02:01 This way, there’s room in the book for new stories. Now let’s take a look at how your Python programs are actually run.

Become a Member to join the conversation.