Loading ...
Sorry, an error occurred while loading the content.

Re: [blug-prog] Question on mem leak

Expand Messages
  • Mayank Rungta
    ... You can try using IBM s Purify (evaluation kit) to find out the process leaking the memory out. You could also use Valgrind for the same. Both the tools
    Message 1 of 6 , Jan 21, 2007
    • 0 Attachment
      Rayapeddi Muralidhar-A15098 wrote:
      >
      > Is there a way of finding out which process is causing the memory leak
      > and how to detect? Appreciate your help.
      >




      You can try using IBM's Purify (evaluation kit) to find out the process
      leaking the memory out. You could also use Valgrind for the same. Both
      the tools give the stack where the memory is being allocated and not
      freed. The output is pretty self explanatory and you should be able to
      fix the problem easily if it's in the user space.

      Hope this helps,
      Mynk
    • Murali Rayapeddi
      ... process leaking the memory out. You could also use Valgrind for the same. Both the tools give the stack where the memory is being allocated and freed. ...
      Message 2 of 6 , Jan 21, 2007
      • 0 Attachment
        Mayank Rungta <mr.mynk@...> wrote:
        >
        > You can try using IBM's Purify (evaluation kit) to find out the
        process leaking the memory out. You could also use Valgrind for the
        same. Both the tools give the stack where the memory is being allocated
        and freed.
        >

        I wanted to find which process is causing the leak first before using
        purify/valgrind or have to run purify for all. My fundamental doubt is
        that why isn't the /proc/<pid>/statm showing any changes in memory leak
        for any process while the top/free outputs show that the free memory is
        decreasing over time.

        -Thanks.
      • Vinay Y S
        ... Use /proc/ /smaps as what would be interesting to know is the private bytes. Of course it s a well known fact that tools like top report wrong memory
        Message 3 of 6 , Jan 28, 2007
        • 0 Attachment
          On 1/21/07, Rayapeddi Muralidhar-A15098 <muralidhar@...> wrote:

          > I wasn't sure as to which application was causing this. So wrote a script to 'cat' the contents of /proc/<pid>/statm of all the processes (including other system processes). The

          Use /proc/<pid>/smaps as what would be interesting to know is the
          private bytes. Of course it's a well known fact that tools like top
          report "wrong" memory usage per process.

          Also, use malloc libraries like tcmalloc that can trace
          allocation/deallocations in a thread.(or write your own overloaded
          methods).

          Also, look at /proc/meminfo (vmstat) to know what's happening with the
          overall system memory and to figure out if any of your kernel modules
          are leaking any memory.

          HTH,
          --
          Vinay Y S
          http://vinay-ys.blogspot.com
        • A.R Karthick
          ... If you have kernel threads running, you cannot go on firing a cat /proc/$PID/status or stat and check for the rss usage for the leak. kernel threads have
          Message 4 of 6 , Jan 28, 2007
          • 0 Attachment
            On 1/21/07, Rayapeddi Muralidhar-A15098 <muralidhar@...> wrote:
            >
            > >I have an application (package) which has around 12-14 different
            > >processes. A couple of processes run at kernel level while the rest run at
            > >application level. There is a memory leak on the machine where the free
            > >memory is decreasing. This is observed using utilities like top, free
            >






            If you have kernel threads running, you cannot go on firing a cat
            /proc/$PID/status or stat and check for the
            rss usage for the leak. kernel threads have the mmstruct of the parent
            through active_mm. So the page directory
            would be that of the init incase its daemonized as is usually the case with
            kernel threads.
            You might want to check rss(resident set size) of the parent. Check for cat
            /proc/1/status on vm rss for daemonized case.
            See if thats increasing. Else another good way to check for leaks in kernel
            threads is to monitor the kernel slab cache
            for the allocated objects. Assuming that you have a rough idea of your
            kmalloc size, round it off to power of 2 (assuming its a kmalloc) and check
            cat /proc/slabinfo for the active objs and active slabs count of your
            allocation size slab cache.
            This is a pretty good way to check leaks in kernel space due to kmalloc.
            kernel space kmalloc leaks would keep accumulating as kernel page table
            entries wont be zapped on module unload.
            ( unlike process exits would cleanup page tables)
            Regards,
            -Karthick



            Software is like sex: it's better when it's free.
            -Linus Torvalds

            A.R.Karthick
            http://mir-os.sourceforge.net


            [Non-text portions of this message have been removed]
          • Rayapeddi Muralidhar-A15098
            Hi, Just wanted to find if there is a way I can kill a particular thread (child thread) of an user application implemented using NPTL under Linux 2.6. Also can
            Message 5 of 6 , May 4, 2007
            • 0 Attachment
              Hi,

              Just wanted to find if there is a way I can kill a particular thread
              (child thread) of an user application implemented using NPTL under Linux
              2.6. Also can you let me know if there is any thread level experiments
              that I can do, like putting a particular thread to sleep (from outside)
              etc.



              -Thanks,

              Murali.



              [Non-text portions of this message have been removed]
            Your message has been successfully submitted and would be delivered to recipients shortly.