3

Our code runs with -XX:+HeapDumpOnOutOfMemoryError flag so we get an hprof file on OOM. Recently I got such a file from an installation, I opened it with Eclipse memory analyzer (MAT) and I can see the total size is 46MB, how can it be if the process was started with -Xmx1024m???

Should not the size be much much closer to the max allocated size??

This is with jdk1.6.

EDIT: ok now I found a similar question and indeed a PermGen space issue could be the reason, as my process has been up for 23 days. I create new threads (that end properly as far as I know) very often, once per second maybe. Anybody knows if I could confirm this somehow?

Community
  • 1
  • 1
Persimmonium
  • 15,593
  • 11
  • 47
  • 78

1 Answers1

1

This would happen if you failed to create a very large object. i.e. the object which you failed to create is not in the dump.

Peter Lawrey
  • 525,659
  • 79
  • 751
  • 1,130
  • yes I thought of that but no other hint points at this...see my edit, I found a relevant question here – Persimmonium Apr 13 '11 at 09:19
  • The simplest way to confirm the cause is to read the original exception. e.g "java.lang.OutOfMemoryError: Java heap space", "java.lang.OutOfMemoryError: PermGen space" or "java.lang.OutOfMemoryError: Direct buffer memory" Also the stack trace should indicate the operation which failed which should give you a clue. – Peter Lawrey Apr 13 '11 at 09:23
  • unfortunately I didn't catch any exception – Persimmonium Apr 13 '11 at 09:37
  • Is there an OOME object in the heap dump? Can you read the message for it? – Peter Lawrey Apr 13 '11 at 09:47
  • No, I searched the heap with a OQL query 'SELECT toString(s) FROM java.lang.OutOfMemoryError s' and got 0 results. – Persimmonium Apr 13 '11 at 10:31
  • I have opened a new more specific question on thread creation – Persimmonium Apr 13 '11 at 11:19
  • 1
    @Peter Lawrey, In my case I am pretty sure it was due to a permgen, but what you mentioned could be also the cause so I'll accept your reply – Persimmonium Apr 20 '11 at 09:06