1

I have a java process I allocated 768MB to at the command line, using the -Xmx switch, but ps says its using over 900MB!

$ ps -e -o pid,rsz,cmd | sort -n -k 2|tail
17271 941096 java ... -Xmx768m -Xms768m -jar ...

(note parts of the command line were redacted for readability)

I found some posts which suggest this can be permgen:

Why is the JVM using more memory than I am allocating

Is it possible for a Java memory leak to use more memory than the heap + permgen?

JVM Process vs JVM Heap memory usage

Is there a way to control how much non-heap memory java uses?

Community
  • 1
  • 1
benhsu
  • 5,346
  • 8
  • 39
  • 47
  • You can control it but you can't make it zero as the JVM, stacks, buffers, code, GUI component etc have to live somewhere. The heap might be the main memory region but there are many, many others. Given 140 MB costs about $1 I wouldn't spend more than a few minutes worrying about it. – Peter Lawrey Jul 27 '15 at 17:36
  • first you need to figure out what's occupying the extra memory, there are many knobs to turn. – the8472 Jul 27 '15 at 17:37
  • @the8472 how can I do that? – benhsu Jul 27 '15 at 17:43
  • You can use `cat /proc/17271/maps` to see where the virtual memory is being used, but like I suggested I would only do this if you are sure this is worth your time doing this. – Peter Lawrey Jul 27 '15 at 17:43
  • [native memory tracking](https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr007.html) may be useful in conjunction with proc maps – the8472 Jul 27 '15 at 18:06

0 Answers0