unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Kevin Ryde <user42@zip.com.au>
Subject: Re: documentation.scm close files
Date: Sat, 24 May 2003 11:50:24 +1000	[thread overview]
Message-ID: <87r86pi04f.fsf@zip.com.au> (raw)
In-Reply-To: <20030522095953.GA10564@www> (tomas@fabula.de's message of "Thu, 22 May 2003 11:59:53 +0200")

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


  reply	other threads:[~2003-05-24  1:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-07 22:58 documentation.scm close files Kevin Ryde
2003-05-17 20:07 ` Marius Vollmer
2003-05-18 22:54   ` Kevin Ryde
2003-05-21 22:40     ` Kevin Ryde
2003-05-22  9:59       ` tomas
2003-05-24  1:50         ` Kevin Ryde [this message]
2003-05-24  8:46           ` tomas
2003-06-05  1:00             ` Kevin Ryde
2003-05-22 15:20       ` Marius Vollmer
2003-05-23 21:20         ` Kevin Ryde
2003-06-01 21:02           ` Marius Vollmer
2003-06-05  1:17         ` doco with-input-from-file, with-output-to-file (was: documentation.scm close files) Kevin Ryde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r86pi04f.fsf@zip.com.au \
    --to=user42@zip.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).