Basically, the memory stack comes from the stack area, which is independent of the heap area and perm area.
Static variables are allocated on the heap, except for string and numeric constants.
Parameter-Xmx limits only the young + old parts of the heap, since the area of permanence is not part of this.
The size of the stack area is set using the flag -Xss, the size of the heap area is set by the flag -Xmx, and the size of the perm area is set -XX:MaxPermSize.
If you want to dive into managing the internal memory of the JVM, I recommend this entry.
fglez source
share