Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Purified zsh-3.0.1



> 2) MLK
>          MLK: 344 bytes leaked in 2 blocks
>          This memory was allocated from:
>                malloc         [rtlib.o]
>                zalloc         [mem.c:315]
>                metafy         [utils.c:2918]
>                createparamtable [params.c:115]
>                setupvals      [init.c:600]
>                main           [init.c:66]
>          Block of 256 bytes at 0x192b18
>          Block of 88 bytes at 0x191df8

That seems to be the same as the last one.  I hope that the patch below
fixes that but I'm not at all sure.  If not please try to figure out which
variable causes that.  That happens when zsh imports the environment.
Start with an empty environment using

(typeset +x -m '*' ; zsh)

and add environment variables.  Hopefully you'll be able to identify the
problematic variable.

> 3) MLK
> Another leak of 344 bytes.  Backtrace follows:
>          MLK: 344 bytes leaked in 2 blocks
>          This memory was allocated from:
>                malloc         [rtlib.o]
>                zalloc         [mem.c:315]
>                zjoin          [utils.c:1442]
>                arrfixenv      [params.c:1778]
>                colonarrsetfn  [params.c:1330]
>                setstrvalue    [params.c:783]
>          Block of 256 bytes at 0x1932e8
>          Block of 88 bytes at 0x192100

I've fount that one that's also fixed by the patch below.

> 4) MLK
> A similar leak, again.
>          MLK: 344 bytes leaked in 2 blocks
>          This memory was allocated from:
>                malloc         [rtlib.o]
>                zalloc         [mem.c:315]
>                zjoin          [utils.c:1442]
>                colonarrgetfn  [params.c:1318]
>                getstrvalue    [params.c:699]
>                getsparam      [params.c:956]
>          Block of 256 bytes at 0x193590
>          Block of 88 bytes at 0x192258

That's bad.  It seems that there is a leak each time getsparam() is called
to a colon array like PATH.  It may be difficult to fix so I'll not even
try it now (2 am).

Zoltan

*** Src/params.c	1996/10/30 23:41:58	3.1.0.0
--- Src/params.c	1996/11/11 00:40:11
***************
*** 1000,1008 ****
  	    v = NULL;
  	}
      }
!     if (!v)
! 	if (!(v = getvalue(&t, 1)))
  	    return NULL;
      setstrvalue(v, val);
      return v->pm;
  }
--- 1000,1011 ----
  	    v = NULL;
  	}
      }
!     if (!v) {
! 	if (!(v = getvalue(&t, 1))) {
! 	    zsfree(val);
  	    return NULL;
+ 	}
+     }
      setstrvalue(v, val);
      return v->pm;
  }
***************
*** 1787,1792 ****
--- 1790,1797 ----
  	pm->flags |= PM_EXPORTED;
      if (pm->flags & PM_EXPORTED)
  	pm->env = addenv(s, u);
+     else
+ 	zsfree(u);
  }
  
  /* Given *name = "foo", it searchs the environment for string *



Messages sorted by: Reverse Date, Date, Thread, Author