From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6706 invoked from network); 19 May 2003 10:09:47 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 19 May 2003 10:09:47 -0000 Received: (qmail 18711 invoked by alias); 19 May 2003 10:09:41 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 18548 Received: (qmail 18700 invoked from network); 19 May 2003 10:09:40 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 19 May 2003 10:09:40 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [62.189.183.235] by sunsite.dk (MessageWall 1.0.8) with SMTP; 19 May 2003 10:9:39 -0000 Received: from exchange01.csr.com (unverified) by (Content Technologies SMTPRS 4.2.1) with ESMTP id for ; Mon, 19 May 2003 11:19:41 +0100 Received: from csr.com (tinky-winky.csr.com [192.168.144.127]) by exchange01.csr.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21) id JWCP5KKG; Mon, 19 May 2003 11:07:20 +0100 To: zw Subject: Re: result of latest memory leak run In-reply-to: "Felix Rosencrantz"'s message of "Fri, 16 May 2003 20:53:24 PDT." <20030517035324.8254.qmail@web10406.mail.yahoo.com> Date: Mon, 19 May 2003 11:09:36 +0100 Message-ID: <27603.1053338976@csr.com> From: Peter Stephenson Felix Rosencrantz wrote: > I ran the latest cvs version of zsh with valgrind in my environment as > my main shell for a few days. I was only able to find one memory > leak, I believe based on the recent fix for (l=() ; vared l): > ==21338== 520 bytes in 3 blocks are definitely lost in loss record 9 of 14 > ==21338== at 0x401667E0: malloc (vg_clientfuncs.c:103) > ==21338== by 0x8086AF5: zalloc (mem.c:490) > ==21338== by 0x81008E9: zleread (zle_main.c:790) > ==21338== by 0x8101D07: bin_vared (zle_main.c:1149) > ==21338== by 0x804B2F5: execbuiltin (builtin.c:440) > ==21338== by 0x806193A: execcmd (exec.c:2345) > ==21338== by 0x805E24E: execpline2 (exec.c:1228) > ==21338== by 0x805D776: execpline (exec.c:1018) Actually, it's older; any vared of an array will leak the string since spacesplit() doesn't free it. I think this may explain some of your previous leaks, so it's good to chase it down. The fact there's a comment but it's already inaccurate suggests I was working here. I think a test-3 is probably warranted. There's no point rushing things now. Index: Src/Zle/zle_main.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_main.c,v retrieving revision 1.32 diff -u -r1.32 zle_main.c --- Src/Zle/zle_main.c 14 May 2003 15:09:15 -0000 1.32 +++ Src/Zle/zle_main.c 19 May 2003 09:59:52 -0000 @@ -1177,9 +1177,10 @@ /* * Use spacesplit with fourth argument 1: identify quoted separators, - * unquote but don't split. + * and unquote. This duplicates the string, so we still need to free. */ a = spacesplit(t, 1, 0, 1); + zsfree(t); if (PM_TYPE(pm->flags) == PM_ARRAY) setaparam(args[0], a); else -- Peter Stephenson Software Engineer CSR Ltd., Science Park, Milton Road, Cambridge, CB4 0WH, UK Tel: +44 (0)1223 692070 ********************************************************************** The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. **********************************************************************