Professional Web Applications Themes

Finding memory leaks through ps command - UNIX Programming

What are the parameters/arguments of 'ps' command can be used to track whether there are memory leaks from a process in its long run?...

  1. #1

    Default Finding memory leaks through ps command

    What are the parameters/arguments of 'ps' command can be used to track
    whether there are memory leaks from a process in its long run?
    qazmlp Guest

  2. #2

    Default Re: Finding memory leaks through ps command

    In article <google.com>,
    com (qazmlp) wrote:
     

    Look at the SZ column of the long format. If it's consistently
    increasing, it *may* indicate a memory leak. It could also be a result
    of the program constantly adding new data to its memory (e.g. a name
    server caching more responses as time goes on).

    --
    Barry Margolin, mit.edu
    Arlington, MA
    Barry Guest

  3. #3

    Default Re: Finding memory leaks through ps command

    In article <attbi.com>,
    Barry Margolin <mit.edu> wrote:
     
    >
    > Look at the SZ column of the long format. If it's consistently
    > increasing, it *may* indicate a memory leak. It could also be a result
    > of the program constantly adding new data to its memory (e.g. a name
    > server caching more responses as time goes on).[/ref]

    It was my understanding that the only way to detect leaks is to
    'instrument' the application with a memory leak detector like Purify.
    I'm not aware of any tools that work for Java since that's not compiled
    code.

    --
    DeeDee, don't press that button! DeeDee! NO! Dee...



    Michael Guest

  4. #4

    Default Re: Finding memory leaks through ps command

    On 1 Jan 2004 19:35:44 -0800, qazmlp <com> wrote: 

    If your application can be easily ported to x86 Linux, you might try
    using Valgrind to find leaks.


    --
    Scott Lacy Smith <net>
    "Nullus Anxietas"
    Scott Guest

  5. #5

    Default Re: Finding memory leaks through ps command

    In article <ash.giganews.com>,
    "Michael Vilain <net>" wrote:
     
    > >
    > > Look at the SZ column of the long format. If it's consistently
    > > increasing, it *may* indicate a memory leak. It could also be a result
    > > of the program constantly adding new data to its memory (e.g. a name
    > > server caching more responses as time goes on).[/ref]
    >
    > It was my understanding that the only way to detect leaks is to
    > 'instrument' the application with a memory leak detector like Purify.[/ref]

    That's why I carefully said "may indicate a memory leak". If the memory
    size isn't increasing, then you probably don't have a leak (if you do,
    it's presumably a very slow one).
     

    In the case of Java, you'd need to instrument the JVM itself.

    --
    Barry Margolin, mit.edu
    Arlington, MA
    Barry Guest

  6. #6

    Default Re: Finding memory leaks through ps command

    "Michael Vilain <net>" writes: [/ref]
     [/ref][/ref]
     [/ref]
     

    That may be the way to *prove* that there is a memory leak. However,
    when I see a process with name "printd" (really "lp") using 187M of
    memory, I can be pretty sure that it is mismanaging memory in some
    manner.

    I guess it is time to kill that process.

    Neil Guest

  7. #7

    Default Re: Finding memory leaks through ps command

    In article <bt3tng$e98$cso.niu.edu>,
    Neil W Rickert <rickert+niu.edu> wrote:
     
    >
    > That may be the way to *prove* that there is a memory leak. However,
    > when I see a process with name "printd" (really "lp") using 187M of
    > memory, I can be pretty sure that it is mismanaging memory in some
    > manner.[/ref]

    Right, you have to understand the memory size in context. To contrast
    with this example, a large Emacs process doesn't necessarily have a
    leak, it may just be because the user has lots of buffers.

    --
    Barry Margolin, mit.edu
    Arlington, MA
    Barry Guest

  8. #8

    Default Re: Finding memory leaks through ps command

    "Michael Vilain " wrote: 
    >>
    >>Look at the SZ column of the long format. If it's consistently
    >>increasing, it *may* indicate a memory leak. It could also be a result
    >>of the program constantly adding new data to its memory (e.g. a name
    >>server caching more responses as time goes on).[/ref]
    >
    >
    > It was my understanding that the only way to detect leaks is to
    > 'instrument' the application with a memory leak detector like Purify.
    > I'm not aware of any tools that work for Java since that's not compiled
    > code.[/ref]

    Yes it is. Anyway, most implementations of Java have mark & sweep
    garbage collection, so memory leaks can't happen. If you are concerned
    about leaks in the bytecode interpreter, you will have to follow Barry's
    suggestion, and instrument the JVM itself.

    Jeff Guest

  9. #9

    Default Re: Finding memory leaks through ps command

    Jeff Schwab <net> writes:
     [/ref][/ref]
     
    >
    > Yes it is. Anyway, most implementations of Java have mark & sweep
    > garbage collection, so memory leaks can't happen. If you are
    > concerned about leaks in the bytecode interpreter, you will have to
    > follow Barry's suggestion, and instrument the JVM itself.[/ref]

    It's not impossible for there to be memory leaks in the JVM. It's
    happened before.

    If a memory leak detector isn't available on the OP's platform, it
    might be worth running the program under strace/truss/whatever and
    grepping for malloc and free, then trying to match them up. Maybe mmap
    too if JVM uses that for memory allocation.

    Joe
    joe@invalid.address Guest

  10. #10

    Default Re: Finding memory leaks through ps command

    address wrote:
     
    >>
    >>Yes it is. Anyway, most implementations of Java have mark & sweep
    >>garbage collection, so memory leaks can't happen. If you are
    >>concerned about leaks in the bytecode interpreter, you will have to
    >>follow Barry's suggestion, and instrument the JVM itself.[/ref]
    >
    > It's not impossible for there to be memory leaks in the JVM. It's
    > happened before.[/ref]

    Understood. Even on a working platform with only reference-counted GC,
    leaks can happen.

    Jeff Guest

  11. #11

    Default Re: Finding memory leaks through ps command

    In article <com>,
    Jeff Schwab <net> wrote:
     

    That would prevent leaks of the application data (assuming the GC works
    properly), but not the JVM's internal data, since the JVM itself is not
    written in Java.

    Also, memory leaks can happen in GC'ed languages. If the application
    keeps references to objects that it doesn't actually need any more, they
    won't become garbage.

    --
    Barry Margolin, mit.edu
    Arlington, MA
    Barry Guest

  12. #12

    Default Re: Finding memory leaks through ps command

    com (qazmlp) wrote in message news:<google.com>... 

    try "ps -l".

    raghavendra.
    Raghavendra Guest

Similar Threads

  1. #26267 [Opn->Ver]: Memory Leaks
    By sniper@php.net in forum PHP Development
    Replies: 0
    Last Post: November 19th, 12:19 AM
  2. #26267 [NEW]: Memory Leaks
    By cunha17 at uol dot com dot br in forum PHP Development
    Replies: 0
    Last Post: November 15th, 09:08 PM
  3. #26000 [Opn->Fbk]: much memory leaks
    By derick@php.net in forum PHP Development
    Replies: 0
    Last Post: October 27th, 10:56 AM
  4. how do I use the memory inspector to check for memory leaks
    By Roofy webforumsuser@macromedia.com in forum Macromedia Director Lingo
    Replies: 2
    Last Post: August 11th, 05:29 AM
  5. Timeouts and Memory Leaks
    By Jerad Rose in forum Microsoft SQL / MS SQL Server
    Replies: 2
    Last Post: July 10th, 03:04 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139