zsh-workers
 help / color / mirror / code / Atom feed
* result of latest memory leak run
@ 2003-05-17  3:53 Felix Rosencrantz
  2003-05-19 10:09 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Felix Rosencrantz @ 2003-05-17  3:53 UTC (permalink / raw)
  To: zw

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)

I suspect folks could find other leaks or memory errors if they valgrind zsh in
their environments.

-FR.




__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: result of latest memory leak run
  2003-05-17  3:53 result of latest memory leak run Felix Rosencrantz
@ 2003-05-19 10:09 ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2003-05-19 10:09 UTC (permalink / raw)
  To: zw

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@csr.com>                  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.
**********************************************************************


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-05-19 10:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-17  3:53 result of latest memory leak run Felix Rosencrantz
2003-05-19 10:09 ` Peter Stephenson

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).