I use two consoles to run python script. One is cmd console, and another is pycharm console. What surprises me is that, the results seem the two different consoles share the same memory space. The detail is as follow pictures shown. There are four phenomena, with which I am confused.
Phenomenon 1: variables in different consoles allocated in the same address
In cmd console, I create three variables, 'a'(the address is 0x7ffaf8346290
), 'b'(the address is 0x7ffaf83462b0
), and 'c'(the address is 0x7ffaf83462d0
).
In pycharm console, I create two variables, 'a'(the address is 0x7ffaf8346290
) and 'b'(the address is 0x7ffaf83462b0
).
Phenomenon 2: variables in the same address, cannot be accessed by two consoles
'c' is pointing to the address 0x7ffaf83462d0
in cmd console. In pycharm console, the address of 3
is 0x7ffaf83462d0
, but 'c' cannot be accessed.
Phenomenon 3: variables created by one console, are affected by the another console allocate memory
In pycharm console, I create two other variables c=5
(the address is 0x7ffaf83462f0
) and d=6
(the address is 0x7ffaf8346310
).
Interestingly, in cmd console, the address of 5
is 0x7ffaf8346310
, same as the address in pycharm console. And the address of 6
is 0x7ffaf8346330
with sequential growth.
Phenomenon 4: list object seems to be not affected
I create two list [1,2,3,4]
in the two consoles respectively, and the addresses of two seems separate from each other.