Re: Question on -Xms/-Xmx and -XX:MaxPermSize in JVM start parameter
Tom Anderson wrote:
On Sat, 9 May 2009, Arne Vajh?j wrote:
If I read the figure in:
http://java.sun.com/docs/hotspot/gc5.0/gc_tuning_5.html#1.1.Sizing%20the%20Generations|outline
correctly then MaxPermSize is not inclusive in Xmx.
But it is not that explicit in the text, so it would be nice if one of
JVM gurus would comment.
I'm no JVM guru, but i do know that this is correct: there are a number
of separate memory pools in the JVM, whose maximum sizes are set
separately. They include the permanent space (set with -XX:MaxPermSize)
and the general heap (set with -X:mx). However, there are more, besides
those two! I don't know much about them, but i know they exist, because
we frequently observe apps using more space than the total of mx and
PermGen. I speculate that it could be stacks or memory allocated by
native code, but i really don't know.
ordinary heap = app objects
perm heap = app class definitions
It seems obvious to me that more stuff is needed - like the JVM itself !
Personally, i find it incredibly irritating that there isn't a flag to
limit total memory use, which is surely what people actually need. I
couldn't give two hoots about the size of PermGen, but if i have a
machine with 4 GM of RAM that's running two app server stacks in
parallel, i bloody well need to be able to put a hard limit of 2 GB (or
whatever) on each. Yes, i can probably do this with ulimit in the
startup script, but why isn't there just an option for it?
All the JVM flags limit virtual memory not RAM.
But if you prefer an OOME instead of degrading performance,
then you could use that limit you want.
Arne