Date: Thu, 06 Aug 1998 02:48:58 -0700 From: David Greenman <dg@root.com> To: Mark Huizer <freebsd@xaa.iae.nl> Cc: freebsd-current@FreeBSD.ORG Subject: Re: memory leaks in libc Message-ID: <199808060948.CAA26488@implode.root.com> In-Reply-To: Your message of "Thu, 06 Aug 1998 10:08:59 %2B0200." <19980806100859.A312@xaa.iae.nl>
next in thread | previous in thread | raw e-mail | index | archive | help
>Hi, a nice user of ours pointed me to the fact that various functions
>like setenv, putenv etc leak memory like crazy. To mention a very
>simple example:
>
>main(){while(1){setenv("A","AA",1);setenv("A","A",1);}}
>
>while consume all memory within short periods of time (see setenv.c for
>the reason).
>
>Is this wellknown? I think it is bad, and would like to fix it
The problem with fixing setenv() is that you don't know if a pointer was
malloced, allocated from the env area above the stack, points to read-only
text, points to a static data buffer, etc. There really is no way to know
for sure, so you can't free the memory.
-DG
David Greenman
Co-founder/Principal Architect, The FreeBSD Project
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199808060948.CAA26488>
