How do you "free" the memory?
Maybe this is a JVM problem, do you use an actual JVM version? Did you check whether it is a known JVM issue?
The JVM's are restarted to free the memory. The VM is 1.6.0_33
It seems to be like this thread https://community.jboss.org/thread/146579 but we are not using NIO
The thread https://community.jboss.org/thread/146579 points to this bug http://bugs.sun.com/view_bug.do?bug_id=6735255 which is about closing ZipInputStream. In our code there seems to be heavy usage of blob reads and writes. But not 'ZipInputStream.'
InputStream ins = fileName.getInputStream();
BufferedReader bug = new BufferedReader( new InputStreamReader(ins));
'ins' is not closed at all. Will heap monitoring track this or 'pmap' ?
You need to close the Stream in any case, i.e. by using a finally block.
Otherwise you may run out of filehandles memory or other resources.
I agree. It is the data that is missing and the way to track it at the OS level. At this time there is no proof that it is eating up the memory. 'Used memory' is high on my RHEL.
I believe I have found the cause. Thousands of such 'anon' blocks in the pmap output. How do I link this back to the InputStream or something else that is causing the leak ?
0000000041fcd000 4 0 0 ----- [ anon ]
0000000041fce000 1024 12 12 rwx-- [ anon ]
00000000420ce000 4 0 0 ----- [ anon ]
00000000420cf000 1024 12 12 rwx-- [ anon ]
00000000421cf000 4 0 0 ----- [ anon ]
00000000421d0000 1024 12 12 rwx-- [ anon ]
00000000422d0000 4 0 0 ----- [ anon ]
00000000422d1000 1024 12 12 rwx-- [ anon ]
00000000423d1000 4 0 0 ----- [ anon ]
00000000423d2000 1024 12 12 rwx-- [ anon ]
00000000424d2000 4 0 0 ----- [ anon ]
00000000424d3000 1024 12 12 rwx-- [ anon ]
Why don't you use heapdump to analyse the issue?
I am trying that too but pmap seems to show that the JVM footprint is increasing due to increase of native memory. The heap limit is never crossed and we don't get any error like OOM. OOM is caused by native memory problems too but in this case the JVM functions but RHEL's ''used memory'' keeps on growing till we bounce JBoss. I see similary JVM problems on the net.