Heap memory in java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Heap memory in java

We know that every java program has it's own memory space. and it consists of the heap and stacks. every thread has it's own stack but they all share the heap. now my question is that is the heap only accessible by the threads of my program, or any program can access it? and if the access is limited, how does this limitation work?

7th Oct 2017, 1:18 PM
Amir Masoud Mostofinejad
Amir Masoud Mostofinejad - avatar
1 Answer
+ 3
This is not really programming specific - your program runs on an operating system, so if the OS allows you to read another running program's memory then yes. That is how some debuggers or software like the cheat engine work. On Windows the only limitation is that a UAC window will pop up before you try to read another processes memory (those little windows where the screen goes darker and you need to click yes). Java also has this thing called RMI where you can kind of share objects between programs or even over the internet.
7th Oct 2017, 3:48 PM
Schindlabua
Schindlabua - avatar