I am using play framework with JAVA for my application. My application consuming more memory than allocated memory. Sometimes I am getting the exception like java.lang.OutOfMemoryException
. please help me, how to find the memory leak in java and how to reduce the memory usage of java? I am using jProfiler
to find the memory leak but I have no improvement on this.
Asked
Active
Viewed 1,637 times
4

Andrew Thompson
- 168,117
- 40
- 217
- 433

MadTech
- 1,458
- 3
- 13
- 32
-
How much is the allocated memory? – Thihara Jun 27 '13 at 12:49
-
I have allocated 150mb but application is taking 280mb – MadTech Jun 27 '13 at 12:51
-
Make a dump, and start digging:) – mavarazy Jun 27 '13 at 13:00
-
1I'd say it's an ok amount depending on what your application does. It's however very hard to find the answer to your problem like this. Your best bet of help will be you in this case. See if you have a huge list, a big array allocation etc in your code. Possible large memory usage instances... Then see if you can get a dumb and find out the problem.. But if I were you I will find out if 150MB is enough for similar applications developed using the framework. – Thihara Jun 27 '13 at 13:07
-
how you deploy your application and where? – weakwire Jul 16 '13 at 12:36
1 Answers
3
A good way to capture a heap dump when a OOME happens is to add the VM parameter -XX:+HeapDumpOnOutOfMemoryError
. You will get a HPROF heap dump that can be opened by JProfiler and other tools.
In JProfiler, the first stop for checking excessive memory consumption is the "Biggest objects" view of the heap walker. In many cases it will be immediately obvious why too much memory is used.

Ingo Kegel
- 46,523
- 10
- 71
- 102