[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: problem of memory leak in re-direction (shell/ash.c: expredir)
From:       Rich Felker <dalias () libc ! org>
Date:       2014-12-15 7:04:28
Message-ID: 20141215070428.GI4574 () brightrain ! aerifal ! cx
[Download RAW message or body]

On Mon, Dec 15, 2014 at 02:55:41PM +0800, shengyong wrote:
> hi, all
> I meet the memory leak problem when use re-direction in a reading-loop, like:
> 
> 	while true
> 	do
> 		while true
> 		do
> 			break
> 		done < /dev/null
> 	done
> 
> There is some discussion on this issue:
> * http://lists.busybox.net/pipermail/busybox/2012-December/078738.html
> * https://bugs.busybox.net/show_bug.cgi?id=5822
> 
> But it is still not fixed in the later versions?

AFAIK it is not fixed. As I stated in the bug report you linked, a
proper fix would require dropping the (semantically invalid) use of
the current stack-like allocation strategy and replacing it with some
sort of reference-tree structure that allows freeing of allocations
other than the most-recent. The easiest way I can see to do this would
be writing an allocator similar to talloc or adapting talloc itself if
the license and code size are acceptable. But in any case I think it's
a non-trivial task and nobody's volunteered to do it.

Rich
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic