1 Reply Latest reply: Aug 18, 2013 1:13 AM by Mohan RSS

    Native memory leak

    Mohan

      Once every few days the used memory of 1.6.0_33(JBoss [Zion] 4.0.3SP1) reaches about 95% of total memory on RHEL(OS-System: Linux 2.6.18-238.el5,amd64).

       

      We have set a max heap size of 1280m.


      Before freeing memory

      VIRT     RES     SHR %MEM

      2764m   1.6g      16m   1.0

       

      After freeing memory

       

      VIRT     RES     SHR %MEM

      2536M   1.1g     16m   14.7

       

      The 'top'' output shows only Java at the top everytime but it does not seem to be using much memory.

       

      The JVM's are restarted to free the memory.

       

      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' ?

       

      Is this a know issue ? Should we close all the streams explicitly or try a newer JVM ?

       

      Thanks.

        • 1. Re: Native memory leak
          Mohan

          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 ]

          Thanks.