From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.lisp.guile.devel Subject: Re: documentation.scm close files Date: Sat, 24 May 2003 11:50:24 +1000 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <87r86pi04f.fsf@zip.com.au> References: <87smrqxt3b.fsf@zip.com.au> <878yt55od2.fsf@zagadka.ping.de> <878yt3yig4.fsf@zip.com.au> <87znlfj54m.fsf@zip.com.au> <20030522095953.GA10564@www> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1053741159 3723 80.91.224.249 (24 May 2003 01:52:39 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 24 May 2003 01:52:39 +0000 (UTC) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat May 24 03:52:38 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19JOD7-0000xv-00 for ; Sat, 24 May 2003 03:52:38 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19JODQ-0001Oj-Vw for guile-devel@m.gmane.org; Fri, 23 May 2003 21:52:57 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19JOCF-0008Nh-Ua for guile-devel@gnu.org; Fri, 23 May 2003 21:51:43 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19JOBy-00081l-Gy for guile-devel@gnu.org; Fri, 23 May 2003 21:51:27 -0400 Original-Received: from snoopy.pacific.net.au ([61.8.0.36]) by monty-python.gnu.org with esmtp (Exim 4.20) id 19JOBH-0006qi-5J for guile-devel@gnu.org; Fri, 23 May 2003 21:50:43 -0400 Original-Received: from sunny.pacific.net.au (sunny.pacific.net.au [203.2.228.40]) h4O1oePB028944 for ; Sat, 24 May 2003 11:50:40 +1000 Original-Received: from wisma.pacific.net.au (wisma.pacific.net.au [210.23.129.72]) by sunny.pacific.net.au with ESMTP id h4O1oeQg029925 for ; Sat, 24 May 2003 11:50:40 +1000 (EST) Original-Received: from localhost (ppp126.dyn228.pacific.net.au [203.143.228.126]) by wisma.pacific.net.au (8.12.9/8.12.9) with ESMTP id h4O1ocYZ023392 for ; Sat, 24 May 2003 11:50:39 +1000 (EST) Original-Received: from gg by localhost with local (Exim 3.35 #1 (Debian)) id 19JOAz-00025s-00; Sat, 24 May 2003 11:50:25 +1000 Original-To: guile-devel@gnu.org Mail-Copies-To: never In-Reply-To: <20030522095953.GA10564@www> (tomas@fabula.de's message of "Thu, 22 May 2003 11:59:53 +0200") User-Agent: Gnus/5.090019 (Oort Gnus v0.19) Emacs/21.2 (gnu/linux) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Developers list for Guile, the GNU extensibility library List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:2438 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:2438 tomas@fabula.de writes: > > it seems important to me to make even clearer that the garbage collector > is triggered when we are short on memory Yep, good point. New words below. > ``the system will trigger the garbage collector based on memory > usage, but it won't notice if it is running low on file descriptors, I guess some sort of file descriptor threshold scheme might be cute. Like garbage collect after every 10 or 20 files net opened (ie. opens less explicit closes). I suppose to be reliable such a scheme would need to be carefully applied to all functions opening or closing fds. Not much value if it's not universal. It is strongly recommended that file ports be explicitly closed when no longer required. Most systems have limits on how many files can be open, both on a per-process and a system-wide basis. A program that uses many files should take care not to hit those limits. The same applies to similar system resources such as pipes and sockets. Note that automatic garbage collection is triggered only by memory consumption, not by file or other resource usage, so a program cannot rely on that to keep it away from system limits. There would be little value in Guile attempting this, since the consequences of even approaching limits tend to be serious both for a program's own operation (eg. libraries accessing files), and for other processes (eg. jobs failing intermittently). An explicit call to `gc' can of course be relied on to pick up unreferenced ports. If program flow makes it hard to be certain when to close then this may be an acceptable way to control resource usage. _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel