Do JVM allocates memory for reference variable and primitive variable of Java code in its own heap and stack?
<p>I have written a Java program having infinite loop on Ubuntu. Name of file is array.java. Please ignore coding standards to be follow.</p>

<pre><code>import java.util.*;
class array  
{
        public static void main(String[] args)
        {
                while(true);
        }
}
</code></pre>

<p>I compiled and run it as:</p>

<pre><code>hduser@pc4:~/codes/java$ javac array.java 
hduser@pc4:~/codes/java$ java array
</code></pre>

<p>Program sucked in the loop. Then i list process running on system there was a process whose name was java with PID 5439. I seen maps file for PID 5439 which looks as:</p>

<pre><code>00400000-00401000 r-xp 00000000 08:01 9581391                            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
00600000-00601000 r--p 00000000 08:01 9581391                            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
00601000-00602000 rw-p 00001000 08:01 9581391                            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
00bbc000-00bdd000 rw-p 00000000 00:00 0                                  [heap]
bfe00000-c1300000 rw-p 00000000 00:00 0
......
......
7f2d70ac2000-7f2d70ac3000 rw-p 00000000 00:00 0
7ffd7f474000-7ffd7f495000 rw-p 00000000 00:00 0                          [stack]
7ffd7f540000-7ffd7f542000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
</code></pre>

<p>In case of c or c++ we have a process in name of executable created by compiler for our written code itself, and that process has its own text, data, heap, stack, etc sections. Corresponding variables gets accommodated in different section of same process.</p>

<p>But in case of Java a different process is running with these sections. These sections not at all belongs to our written code, even our written code is not creating any separate process.</p>

<p>My question is:
Do variables in my code gets accommodated in various sections(Text, heap, stack etc..) of JVM itself?</p>