problem of memory leak in re-direction (shell/ash.c: expredir)

2014-12-14 Thread shengyong
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?

thanks  regards

___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: problem of memory leak in re-direction (shell/ash.c: expredir)

2014-12-14 Thread Rich Felker
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