[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Need for scm_remember_upto_here_* in guile-2.0
From: |
Chris Vine |
Subject: |
Re: Need for scm_remember_upto_here_* in guile-2.0 |
Date: |
Wed, 23 Sep 2015 09:41:46 +0100 |
On Wed, 23 Sep 2015 09:26:27 +0200
David Kastrup <address@hidden> wrote:
> Chris Vine <address@hidden> writes:
>
> > On Wed, 23 Sep 2015 00:35:09 +0100
> > Chris Vine <address@hidden> wrote:
> >> I think you were trying to answer my question, which was: "... is
> >> the point that the scm_remember_upto_here_* functions are in
> >> practice only needed for smobs which provide their own free
> >> function?" (that is, which have no finalisers). I think you were
> >> giving the answer "Yes".
> >
> > Err, "... which have finalisers".
> >
> > Assuming this is the case, the guile manual example is rather
> > unhelpful.
>
> There are other forms of finalization than giving back memory, like
> closing file descriptors, relinquishing a lock or semaphore and so on.
> Also, a pointer to an array (rather than something more opaque like
> SCM) is much more likely to be subject to strength reduction and
> address arithmetic by the compiler, leading to a situation where
> looping through some array does not leave a live pointer in
> registers and stack frame in a form recognizable by libgc.
I am not sure if we are on the same page. I realise that finalisers are
not only concerned with memory. In fact, because there is proper
garbage collection in guile-2.0, in a well designed smob memory is
likely to be the least common thing they manage. It so happens that
you set the smob's finalisers (whatever they happen to do) with
scm_set_smob_free() (the "free function" that I referred to).
However, I haven't understood your point about arrays. If they are
allocated with malloc() you need a finaliser and you may need to call
scm_remember_upto_here_1() to prevent the smob's finaliser from firing
while they are still in use. If they are allocated with scm_gc_malloc()
you don't, as I understand it. Were you making a point in addition to
that, and if so could you expand on it for me?
Chris
- Need for scm_remember_upto_here_* in guile-2.0, Chris Vine, 2015/09/12
- Re: Need for scm_remember_upto_here_* in guile-2.0, Ludovic Courtès, 2015/09/22
- Re: Need for scm_remember_upto_here_* in guile-2.0, David Kastrup, 2015/09/22
- Re: Need for scm_remember_upto_here_* in guile-2.0, Mark H Weaver, 2015/09/22
- Re: Need for scm_remember_upto_here_* in guile-2.0, David Kastrup, 2015/09/22
- Re: Need for scm_remember_upto_here_* in guile-2.0, Ludovic Courtès, 2015/09/22
- Re: Need for scm_remember_upto_here_* in guile-2.0, Chris Vine, 2015/09/22
- Re: Need for scm_remember_upto_here_* in guile-2.0, Chris Vine, 2015/09/22
- Re: Need for scm_remember_upto_here_* in guile-2.0, David Kastrup, 2015/09/23
- Re: Need for scm_remember_upto_here_* in guile-2.0,
Chris Vine <=
- Re: Need for scm_remember_upto_here_* in guile-2.0, David Kastrup, 2015/09/23
- Re: Need for scm_remember_upto_here_* in guile-2.0, Chris Vine, 2015/09/23
- Re: Need for scm_remember_upto_here_* in guile-2.0, David Kastrup, 2015/09/23
- Re: Need for scm_remember_upto_here_* in guile-2.0, Chris Vine, 2015/09/23