Professional Web Applications Themes

'kill' does not reclaim the process' resources, causes memory leak - Linux / Unix Administration

This is my problem on a number of systems (including embedded): I have to run arbitrary binary programs, killing each "from outside". This is done for a few hundred times, under speed measurements. It seems that each 'kill'/'killall' causes the system to leak memory. Thus, the system slows down and speed measurements degrade. Did somebody encounter such or similar problem? Any solution? Is there some trick to kill a process and reclaim all its resources?...

  1. #1

    Default 'kill' does not reclaim the process' resources, causes memory leak

    This is my problem on a number of systems (including embedded):

    I have to run arbitrary binary programs, killing each "from outside".
    This is done for a few hundred times, under speed measurements.

    It seems that each 'kill'/'killall' causes the system to leak memory.
    Thus, the system slows down and speed measurements degrade.

    Did somebody encounter such or similar problem? Any solution?
    Is there some trick to kill a process and reclaim all its resources?

    guybas@yahoo.com Guest

  2. #2

    Default Re: 'kill' does not reclaim the process' resources, causes memoryleak

    com wrote: 

    What is happening to the process when you kill it? Does it remain in
    the process list as a zombie? Is its parent cleaning up after it? What
    is its parent?

    If you could show or tell more about it, that'd be helpful.

    - Mike
    Michael Guest

  3. #3

    Default Re: 'kill' does not reclaim the process' resources, causes memoryleak

    Michael Trausch wrote: [/ref]
    Something like??
    while :
    do
    prog &
    kill -9 $!
    done

    I guess adding a 'sleep' command to the loop would thwart your speed
    measurements.
     [/ref]

    Memory leaks in applications cuase the memory consumption to increase
    and performance to degrade. We sometimes kill processes and restart the
    application to free up leaked memory.

    If 'kill' removes all traces of the user process, then the memory leak
    could only be in the kernel.
     [/ref]

    What resources are we talking about? Normal memory should be reclaimed
    when a process terminates, and so should open files and sockets. Shared
    memory, message queues and semaphores remain in use if the program does
    not release them properly.
     

    A zombie process uses up no resources except for the process table
    entry. However, if a process 'hangs' in a system call that never
    completes, the kill signal is not delivered and resources remain in use.
     

    Indeed it might,


    Daniel

    Daniel Guest

  4. #4

    Default Re: 'kill' does not reclaim the process' resources, causes memory leak

    <com> wrote: 

    What a horrible design.
     

    Kill itself almost certainly does not leak memory. If you have binaries that
    don't clean up properly when killed, they can leak resources. In Unix, it's
    fairly difficult for this to happen, though, if all the processes are really
    gone.
     

    When a process dies, all it's resources should be released. If that's not
    happening, you'll need to figure out what specific resources these specific
    binaries are failing to release and why.

    My first guess would be that you're looking in the wrong place. Something
    else is causing the slowdown.
    --
    Mark Rafn net <http://www.dagon.net/>
    Mark Guest

  5. #5

    Default Re: 'kill' does not reclaim the process' resources, causes memory leak

    On 15 Jan 2006 03:24:53 -0800, com wrote: 

    Usually this happens if System V IPC resources were allocated by the
    programs in question. These resources will not be cleared automatically
    if a program is terminated. The command ipcs can be used to show the
    active message queues/semaphores/shared memory segments.

    Helmut

    --
    Almost everything in life is easier to get into than out of.
    (Agnes' Law)
    Helmut Guest

  6. #6

    Default Re: 'kill' does not reclaim the process' resources, causes memory leak

    In article <googlegroups.com>,
    <com> wrote: 

    kill -15 gives an app time to clean up after itself.
    kill -9 is 'shoot on site' and can leave files open - including any
    temp things that may have been used. Could that have anything to
    do with your problem?

    Bill
    --
    Bill Vermillion - bv wjv . com
    Bill Guest

  7. #7

    Default Re: 'kill' does not reclaim the process' resources, causes memory leak

    Mark Rafn <net> wrote: [/ref]
     
     [/ref]
     

    You haven't worked with many perle programmers.

    Mike
    mtfester@netMAPSONscape.net Guest

Similar Threads

  1. Win32::Process Kill Process in Windows ME
    By Stefan Mueller in forum PERL Modules
    Replies: 3
    Last Post: April 15th, 07:35 PM
  2. Replies: 0
    Last Post: March 1st, 10:42 AM
  3. Replies: 22
    Last Post: December 8th, 03:59 PM
  4. Replies: 3
    Last Post: October 15th, 03:34 PM
  5. Memory consumption of Ruby/mod_ruby combo on Apache [memory leak]
    By David Heinemeier Hansson in forum Ruby
    Replies: 4
    Last Post: September 10th, 01:58 AM

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