I am in the process of learning Python and I got intrigued by the memory management topic: heap, stack, garbage collector etc.
So, for a simple program like:
a=5
print(id(a))
b=2
print(id(b))
c=a+b
print(id(c))
I’d like to be able to watch the memory used by this process, its content and structure.
I found out that I have to do a dump of the python process while running, and I was able to do it on my linux laptop.
Then I opened the resulting file with a HEX reader and was able to find the variables searching for the value and variable name.
I’d like to understand instead how to find the variable based on its memory address that I presume comes from the id() function.
I am also interested to understand how to see “line” between stack and heap.
I know that it sounds overkilling but I’m just curious to see how this whole thing works and then maybe try with lists and dictionaries.
Hope I explained everything properly.
Thanks to whoever would like to help.