[Gc] Problems with interior pointers

Carsten Kehler Holst kehler at pdc.dk
Fri May 29 09:10:09 PDT 2009


We are having a problem with interior pointers not holding on to a

It might be solved in the current version of the gc. If that is the case
we would be very thankful for a pointer in the right direction.

We are running a slightly modified version of 6.8.



The problem comes if you allocate a structure larger than 4096 and refer
to it with an interior pointer that points beyond position 1014 but
within 4096.

Such a structure are almost immediately reclaimed and the data thus


I have included a small visual-prolog predicate that illustrate the
problem below (I hope it is readable for non-prolog folks).


Any help is much appreciated.



Carsten Kehler Holst

Prolog Development Center.


class facts
    s : (string FirstChar, string Tail).

class predicates
    test : ().
        Char = randomChar(),
        NewS = string::create(2048, Char),  % has to be bigger than 2047
for it to fail
        string::front(NewS, 600, _HeadOfString, TailOfString), % has to
be smaller than 2048 for it to fail (and bigger than 507 !!!)
        assert(s(Char, TailOfString)), % save the interior pointer
        OverWritten = [s(C,S)||s(C,S), not(string::hasPrefix(S, C,_)),
retractall(s(C,S))], % find overwritten strings (not starting with the
Char that filled them)
        if OverWritten = [s(C1,S1)|_] then
            stdIO::write("failed : ", C1, " overwritten with ", S1,
        end if,
class predicates
    randomChar : () -> string SingleCharString.
    randomChar() = list::nth(math::random(25),
,"s","t","u","v","w", "x","y","z"]).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://napali.hpl.hp.com/pipermail/gc/attachments/20090529/fd742cb7/attachment-0001.htm

More information about the Gc mailing list