From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.lisp.guile.devel Subject: system* memory leak Date: Fri, 02 Apr 2004 08:06:29 +1000 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <873c7nwdy2.fsf@zip.com.au> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1080857382 30036 80.91.224.253 (1 Apr 2004 22:09:42 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 1 Apr 2004 22:09:42 +0000 (UTC) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Apr 02 00:09:36 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1B9ANT-0007Rz-00 for ; Fri, 02 Apr 2004 00:09:35 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B9AM3-0000Oh-EY for guile-devel@m.gmane.org; Thu, 01 Apr 2004 17:08:07 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1B9ALX-00007d-Es for guile-devel@gnu.org; Thu, 01 Apr 2004 17:07:35 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1B9AKm-0007iU-D3 for guile-devel@gnu.org; Thu, 01 Apr 2004 17:07:19 -0500 Original-Received: from [61.8.0.85] (helo=mailout2.pacific.net.au) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B9AKl-0007h2-Lt for guile-devel@gnu.org; Thu, 01 Apr 2004 17:06:47 -0500 Original-Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au [61.8.0.86]) by mailout2.pacific.net.au (8.12.3/8.12.3/Debian-6.6) with ESMTP id i31M6j5v001555 for ; Fri, 2 Apr 2004 08:06:45 +1000 Original-Received: from localhost (ppp2E4E.dyn.pacific.net.au [61.8.46.78]) by mailproxy1.pacific.net.au (8.12.3/8.12.3/Debian-6.6) with ESMTP id i31M6iGP001122 for ; Fri, 2 Apr 2004 08:06:45 +1000 Original-Received: from gg by localhost with local (Exim 3.36 #1 (Debian)) id 1B9AKU-0000Ry-00; Fri, 02 Apr 2004 08:06:30 +1000 Original-To: guile-devel@gnu.org Mail-Copies-To: never User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3 (gnu/linux) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:3583 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:3583 --=-=-= * simpos.c (scm_system_star): Fix execargv memory leak. This occurs on any invocation, eg. (while #t (system* "true")) The diff is bigger than it might be since I rearranged to combine the parent and fork-error cases. This is definitely a leak, but there seems to be a further problem with sigaction afflicting system*, see other message. --=-=-= Content-Disposition: inline; filename=simpos.c.leak.diff --- simpos.c.~1.55.~ 2004-03-31 11:57:03.000000000 +1000 +++ simpos.c 2004-04-01 07:09:02.000000000 +1000 @@ -158,12 +158,26 @@ oldquit = scm_sigaction (sigquit, sig_ign, SCM_UNDEFINED); pid = fork (); - if (pid == -1) - SCM_SYSERROR; - else if (pid) + if (pid == 0) { - int wait_result; - int status; + /* child */ + execvp (SCM_STRING_CHARS (SCM_CAR (args)), execargv); + scm_remember_upto_here_1 (args); + SCM_SYSERROR; + /* not reached. */ + return SCM_BOOL_F; + } + else + { + /* parent */ + int wait_result, status, save_errno; + + save_errno = errno; + free (execargv); + errno = save_errno; + if (pid == -1) + SCM_SYSERROR; + SCM_SYSCALL (wait_result = waitpid (pid, &status, 0)); if (wait_result == -1) SCM_SYSERROR; scm_sigaction (sigint, SCM_CAR (oldint), SCM_CDR (oldint)); @@ -171,14 +185,6 @@ scm_remember_upto_here_2 (oldint, oldquit); return SCM_MAKINUM (0L + status); } - else - { - execvp (SCM_STRING_CHARS (SCM_CAR (args)), execargv); - scm_remember_upto_here_1 (args); - SCM_SYSERROR; - /* not reached. */ - return SCM_BOOL_F; - } } else SCM_WRONG_TYPE_ARG (1, SCM_CAR (args)); --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel --=-=-=--