0

I run a Java program on an Ubuntu server. I allocate max 2560 MB to Java heap and max 128 MB to Java PermGen using the command-line parameters. After an hour or so I go take a look at memory usage. From inside the Java app it looks like it still has allocated about 2500 MB to heap but in ubuntu it looks like the JVM is using 3500 MB!

How can this be? Surely the JVM shouldn't use more than heap + permgen + a little more for stack and some other small stuff.

0

1 Answer 1

0

If it is a multithreaded application, each thread will have its own stack. If you you provide parameter -xss for stack memory of thread then it is quite possible.

Sign up to request clarification or add additional context in comments.

3 Comments

You'd need at least a few hundred threads to tie up that much stack space.
@cHao which can happen, if he has a few hundred clients on server side and for each client allocate: a reader + a writer + a worker thread
@matheszabi: Eh. One would have to be trying to waste threads in order to come up with a design like that. But i guess.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.