1

As I was studying about the memory management in python. I came across the heap. So a question was raised in my mind. Where is the heap stored?

Some websites where I have looked for an answer do not have a satisfactory explanation.

Nordle
  • 2,915
  • 3
  • 16
  • 34
Rahul Pandey
  • 115
  • 1
  • 7
  • 1
    It's in the memory of the Python process, possibly using a function like `malloc()` in C. – Barmar Jun 27 '19 at 06:00
  • You can access an object's entry by `id()`, i.e. `a=[1,2,3]; addr=id(a)`, see [more](https://stackoverflow.com/questions/121396/accessing-object-memory-address). – knh190 Jun 27 '19 at 07:39

1 Answers1

0

stack and heap are generic concepts regarding how the operating system manages the memory allocated to processes during run time. These concepts are not exclusive to Python programming language. Please, checkout this very informative stackoverflow answer for a general idea if these concepts are new for you. Once familiar with stack and heap checkout this Python document which gives more information about memory management in python.

Another link explaining stack and heap concept.

hope this helps !

dorKKnight
  • 119
  • 1
  • 5