unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Han-Wen Nienhuys <hanwen@cs.uu.nl>
Cc: Marius Vollmer <marius.vollmer@uni-dortmund.de>, guile-devel@gnu.org
Subject: Re: port initialization?
Date: Thu, 8 Aug 2002 22:54:22 +0200	[thread overview]
Message-ID: <15698.55934.287636.6739@blauw.xs4all.nl> (raw)
In-Reply-To: <87lm7h2iu1.fsf@zagadka.ping.de>

mvo@zagadka.ping.de writes:
> > >Yes, but the GC will not notice since "z" still refers to it and
> > >therefore the port cell wont be freedo
> > 
> > That's not what I meant: z is a heap cell containing a null
> > pointer. GC-ing it will dump core.
> 
> Sure?  Closed ports do contain NULL pointers as well and the GC can
> handle them just fine.  The second word of a cell that is tagged as a
> port is not a SCM.  The GC knows that and will not try to follow it
> (except when freeing a port cell but then only when it is not flagged
> as closed).  Am I missing somthing?

Perhaps I'm missing something. I think that having null pointers in
the heap is not a good idea, but of course you're right (just
checked), there are lots of checks to prevent a core dump.

> > > > 	SCM port = scm_cell (scm_tc16_port, newport);
> > > > 	newport->port = port;
> > > > 		      ..
> > > >     }
> > > /
> > > This will leak newport when the call to scm_cell throws.
> > 
> > scm_cell throws, what do you mean?
> 
> I meant, when we run out of memory.  Does scm_cell signal an error
> then (als scm_misc_error), or does it just abort the process?

All errors in the GC cause an abort(), AFAIK.

(checking)

No, there are some out-of-memory errors, and scm_misc_errors, mainly
for programming errors (rogue pointer, undefined smob type, etc.). I
think that this is a bad idea. Unwinding the stack (which is done in
scm_error, right?) wlil stop the GC halfway. I think this will lead
unpredictable results.

An out-of-memory error should be handled gracefully, I would says
although I can't really imagine how (there is little code that can
run, if you can't alloc a string or a cell, right?)


-- 
Han-Wen Nienhuys   |   hanwen@cs.uu.nl   |   http://www.cs.uu.nl/~hanwen 

_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


  reply	other threads:[~2002-08-08 20:54 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-04 14:42 port initialization? Han-Wen
2002-08-08 17:33 ` Marius Vollmer
2002-08-08 19:35   ` Han-Wen Nienhuys
2002-08-08 20:31     ` Marius Vollmer
2002-08-08 20:54       ` Han-Wen Nienhuys [this message]
2002-08-08 21:14         ` Marius Vollmer
2002-08-08 23:17           ` Han-Wen Nienhuys
2002-08-10 13:30             ` Marius Vollmer
2002-08-16 22:06               ` Han-Wen Nienhuys
2002-08-17  0:21                 ` Marius Vollmer
2002-08-08 23:20           ` Lynn Winebarger
2002-08-09  8:06             ` Han-Wen Nienhuys
2002-08-10 13:33             ` Marius Vollmer
2002-08-10 14:12               ` Lynn Winebarger
2002-08-11 15:57                 ` Marius Vollmer
2002-08-08 19:37   ` Han-Wen Nienhuys
2002-08-08 20:32     ` Marius Vollmer
2002-08-08 23:07       ` Han-Wen Nienhuys
2002-08-10 13:09         ` Marius Vollmer
2002-08-16 22:06           ` Han-Wen Nienhuys

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=15698.55934.287636.6739@blauw.xs4all.nl \
    --to=hanwen@cs.uu.nl \
    --cc=guile-devel@gnu.org \
    --cc=marius.vollmer@uni-dortmund.de \
    /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).