zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: zw <zsh-workers@sunsite.dk>
Subject: Re: memory leaks report
Date: Thu, 18 Mar 2004 11:54:23 +0000	[thread overview]
Message-ID: <7554.1079610863@csr.com> (raw)
In-Reply-To: "Felix Rosencrantz"'s message of "Tue, 09 Mar 2004 23:46:09 PST." <20040310074609.94301.qmail@web10406.mail.yahoo.com>

Felix Rosencrantz wrote:
> Here are the latest memory leaks found by valgrind from around March 6th.
> Most were all found before, but I didn't provide much context....  So here's
> a little more.  If there is a a simple way to force the tests to execute a
> separate shell per testcase, it would make it easier to link up the leaks to
> the test case.

You can set ZTST_verbose=2 in the environment to give more context
for the tests, so you can see when reports appear.  A separate shell
for each test is harder (and slower).

> Test E01options:
> Valgrind reports an error summary after every zsh subprocess exits.  Running
> the
> E01options test, there are 42 error summaries.  This leak is first reported=
>  in
> the 32nd error summary.  It looks like there are 48 tests.
> 493 bytes in 1 blocks are definitely lost in loss record 16 of 21
>    at  malloc (vg_replace_malloc.c:153)
>    by  zalloc (mem.c:490)
>    by  mkenvstr (params.c:3423)
>    by  addenv (params.c:3386)
>    by  restore_params (exec.c:2590)

Well, well, well, who would have thought it, a bug in the parameter
code.  I think it's the following, which looks like it should logically
be there in save_params to match the chunk in restore_params which is
causing the leak.

Index: Src/exec.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/exec.c,v
retrieving revision 1.57
diff -u -r1.57 exec.c
--- Src/exec.c	13 Nov 2003 14:34:38 -0000	1.57
+++ Src/exec.c	18 Mar 2004 11:43:38 -0000
@@ -2519,6 +2519,10 @@
     while (wc_code(ac = *pc) == WC_ASSIGN) {
 	s = ecrawstr(state->prog, pc + 1, NULL);
 	if ((pm = (Param) paramtab->getnode(paramtab, s))) {
+	    if (pm->env) {
+		delenv(pm->env);
+		pm->env = NULL;
+	    }
 	    if (!(pm->flags & PM_SPECIAL)) {
 		paramtab->removenode(paramtab, s);
 	    } else if (!(pm->flags & PM_READONLY) &&

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************


  parent reply	other threads:[~2004-03-18 11:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-10  7:46 Felix Rosencrantz
2004-03-18 11:34 ` Peter Stephenson
2004-03-18 11:54 ` Peter Stephenson [this message]
2004-03-18 12:21 ` Peter Stephenson
2004-03-18 12:28 ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7554.1079610863@csr.com \
    --to=pws@csr.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).