I have few questions regarding java GC and memory management.
In java we define process memory upper bound and lower bound by xmx and xms parameters. Using these parameters JVM allocates young old and perm space. So if new threads are created then from which memory do stacks memory is allocated to threads? is it from perm space or any other space?
Also static variables of class is allocated to which space young, old or perm space? (I guess perm?)
Does XmX paramenter bounds the young + old gen OR young + old+ perm gen OR young + old + perm + stack size ??
Thanks
Basicly, stack memory comes from stack area, which is independent from heap area and perm area.
Static variables are allocated in the heap, except string and numeric constants.
-Xmx
parameter only bounds the young + old parts of the heap, as perm area is not part of it.
Stack area size is set by -Xss
flag, heap area size is set by -Xmx
flag and perm area size is set by -XX:MaxPermSize
.
If you want to dive into JVM internal memory management I recommend this blog entry.