bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: File descriptor leak in nested functions


From: Chet Ramey
Subject: Re: File descriptor leak in nested functions
Date: Sun, 18 Apr 2010 09:35:17 -0400
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.7) Gecko/20100111 Lightning/1.0b1 Thunderbird/3.0.1

On 4/18/10 1:33 AM, Dennis Williamson wrote:
> For those who might be interested, here's a much simpler function that
> exhibits the same kind of leak and doesn't involve nested functions.
> 
> fd_leaker() { while :; do read a < <(pwd); c=(/proc/$$/fd/*);
> address@hidden; echo $c; done; }
> 
> For some reason, adding "(exit 0); " right before the "done" seems to
> limit the creation of extra file descriptors.
> 
> The problem seems to be related to read and subshells.

Not quite.  The problem has to do with process substitution and builtins.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]