Date: Thu, 6 Aug 1998 08:47:45 -0600 From: Nate Williams <nate@mt.sri.com> To: dg@root.com Cc: Narvi <narvi@haldjas.folklore.ee>, Bruce Evans <bde@zeta.org.au>, freebsd@xaa.iae.nl, freebsd-current@FreeBSD.ORG Subject: Re: memory leaks in libc Message-ID: <199808061447.IAA12240@mt.sri.com> In-Reply-To: <199808061238.FAA28204@implode.root.com> References: <Pine.BSF.3.96.980806152019.9173B-100000@haldjas.folklore.ee> <199808061238.FAA28204@implode.root.com>
next in thread | previous in thread | raw e-mail | index | archive | help
David wrote: > 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. Bruce responded: > You can know if you malloced it in a previous call to putenv() or setenv(). David replied: > Perhaps Bruce is suggesting that a seperate array be allocated to keep > track of whether or not an env pointer was malloced? This would be very > costly and, IMO, not worth it considering how rarely memory is lost by > not freeing previously malloced strings. Very costly? Could you do almost all of it in the userland libraries, and would be pretty cost-free, especially considering it would only have much effect if the user did lots of environment allocations? Nate 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?199808061447.IAA12240>