Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Nov 2001 23:12:21 +0300 (MSK)
From:      Maxim Konovalov <maxim@macomnet.ru>
To:        Alfred Perlstein <bright@mu.org>
Cc:        Bob Bishop <rb@gid.co.uk>, <hackers@FreeBSD.ORG>
Subject:   Re: Committer please
Message-ID:  <20011105223436.K7338-100000@news1.macomnet.ru>
In-Reply-To: <20011105130328.G89342@elvis.mu.org>

next in thread | previous in thread | raw e-mail | index | archive | help

Hello,

On Mon, 5 Nov 2001, Alfred Perlstein wrote:

> * Bob Bishop <rb@gid.co.uk> [011105 06:35] wrote:
> > Hi,
> >
> > Would some kind committer please have a look at bin/31533: /bin/sh memory
> > leak. There is a patch there which I believe is OK. Having a memory leak
> > loose in the shell seems like a Bad Idea to me. TIA
>
> Understandable, things like this could be applied more quickly if
> someone would take the time to explain what the delta does other
> than fix the problem.  Meaning, what is VTEXTFIXED, and what does
> removing it change?

OK, mea culpa.

/usr/src/bin/sh/var.h:48

#define VTEXTFIXED      0x08    /* text is staticly allocated */

Afaiu it is used for internal variables names which are statically
allocated in /usr/src/bin/sh/var.c:102. VTEXTFIXED prevents them from
freing:

/usr/src/bin/sh/var.c:319

                        if ((vp->flags & (VTEXTFIXED|VSTACK)) == 0)
                                ckfree(vp->text);

PWD and OLDPWD variables are not statical ones and should be
reallocated every time when changed.

- -maxim

-- 
Maxim Konovalov, MAcomnet, Internet-Intranet Dept., system engineer
phone: +7 (095) 796-9079, mailto: maxim@macomnet.ru






To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011105223436.K7338-100000>