Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Jun 2010 22:37:45 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        cvs-src-old@freebsd.org
Subject:   cvs commit: src/bin/sh expand.c jobs.c jobs.h sh.1
Message-ID:  <201006292238.o5TMc26I093978@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
jilles      2010-06-29 22:37:45 UTC

  FreeBSD src repository

  Modified files:
    bin/sh               expand.c jobs.c jobs.h sh.1 
  Log:
  SVN rev 209600 on 2010-06-29 22:37:45Z by jilles
  
  sh: Forget about terminated background processes sooner.
  
  Unless $! has been referenced for a particular job or $! still contains that
  job's pid, forget about it after it has terminated. If $! has been
  referenced, remember the job until the wait builtin has reported its
  completion (either with the pid as parameter or without parameters).
  
  In interactive mode, jobs are forgotten after termination has been reported,
  which happens before primary prompts and through the jobs builtin. Even
  then, though, remember a job if $! has been referenced.
  
  This is similar to what is suggested by POSIX and should fix most memory
  leaks (which also tend to cause sh to use more CPU time) with long running
  scripts that start background jobs.
  
  Caveats:
  * Repeatedly referencing $! without ever doing 'wait', like
      while :; do foo & echo started foo: $!; sleep 60; done
    will still use a lot of memory and CPU time in the long run.
  * The jobs and jobid builtins do not cause a job to be remembered for longer
    like expanding $! does.
  
  PR:             bin/55346
  
  Revision  Changes    Path
  1.65      +2 -2      src/bin/sh/expand.c
  1.78      +56 -5     src/bin/sh/jobs.c
  1.20      +3 -1      src/bin/sh/jobs.h
  1.142     +5 -1      src/bin/sh/sh.1



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201006292238.o5TMc26I093978>