Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: result of latest memory leak run
- X-seq: zsh-workers 18548
- From: Peter Stephenson <pws@xxxxxxx>
- To: zw <zsh-workers@xxxxxxxxxx>
- Subject: Re: result of latest memory leak run
- Date: Mon, 19 May 2003 11:09:36 +0100
- In-reply-to: "Felix Rosencrantz"'s message of "Fri, 16 May 2003 20:53:24 PDT." <20030517035324.8254.qmail@xxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
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 <pws@xxxxxxx> 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.
**********************************************************************
Messages sorted by:
Reverse Date,
Date,
Thread,
Author