From the course: Programming Foundations: Memory, Pointers, and Garbage Collection
Unlock the full course today
Join today to access over 25,200 courses taught by industry experts.
Garbage collection - Python Tutorial
From the course: Programming Foundations: Memory, Pointers, and Garbage Collection
Garbage collection
- [Narrator] So freeing up the memory of the heap can be done by a process called garbage collection. Some languages like C and C++ require manual garbage collection by code. Typically, it's not called garbage collection then. Languages that have an automatic garbage collection building are for example, CCR, Java, Python and actually many other high level languages. There are some common errors that are not happening when we use a garbage collector. First of all, the dangling pointer bugs can be avoided. This is when the developer did free up the memory space but the pointer is still pointing to the old place where a certain variable is stored. You can imagine that this can lead to unpredictable events such as a pointer returning a surprise value, when the memory location has been reassigned to another value. Another common problem that developers with automatic garbage collection don't run into is the bug of freeing up a…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
What is memory?3m 43s
-
(Locked)
Why do we need to manage the memory?3m 19s
-
(Locked)
Stack memory3m 17s
-
(Locked)
Heap memory3m 39s
-
(Locked)
Heap vs. stack memory6m 47s
-
(Locked)
Allocating memory1m 49s
-
(Locked)
Deallocating memory1m 53s
-
(Locked)
Garbage collection6m 50s
-
(Locked)
Actual removing or sweeping2m 48s
-
-
-
-
-