This is the mail archive of the guile@sources.redhat.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: String representation proposal


Mikael Djurfeldt <mdj@mdj.nada.kth.se> writes:

> > Say there were two strings pointing to one shared character record:
> > 
> > A -> <a>
> > 
> > B -> <a>
> > 
> > What if there are no references to A and <a> is <white, shared>.
> > GC mark doesn't reach <a> through A.  However it reaches <a> through B
> > and changes it to <black, private>.  GC sweep frees A and then
> > frees <a>.
> >
> > On the other hand what if there are no references to A or B?  Now 
> > <a> remains <white, private> and is freed twice.  Hmmm.

Actually, the first problem above is only a problem in my
specification.  The sweep phase should of course not free anything
which is black, because the blackness indicates that the record is in
use.

The second problem is serious, however.  In fact, we can't even allow
following the reference to <a> the second time, because that memory is
freed!

I guess we have to delay freeing of character records until all cells
have been swept, similar to how certain other mechanisms work (weak
pointers, guardians, struct freeing etc).

Further suggestions?

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]