Concept

Heap Allocation

In heap allocation, memory is allocated based on the Python code written. It is a pile of memory available for the program. All objects are stored in the heap memory. When an object is created, it is allocated in the heap memory while referencing information for it is stored in the stack allocation when necessary. Heap memory is also what allows for global variables. Since heap memory is more dependent on the program, and thus the programmer, it also also less safe than stack memory and has the potential to create a memory leak. If the heap memory ends up becoming completely full, the program can no longer run and will throw a specific error called an out of memory error. Memory deallocation in the heap memory requires the use of a garbage collector.

0

1

Updated 2021-06-14

Contributors are:

Who are from:

Tags

Python Programming Language

Data Science

Related
Learn After