[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
structure.

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
overwritten.

 

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.

 

Regards

Carsten Kehler Holst

Prolog Development Center.

 

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

class predicates
    test : ().
clauses    
    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
TailOfString
        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,
"\n")
        end if,
        test().
    
class predicates
    randomChar : () -> string SingleCharString.
clauses
    randomChar() = list::nth(math::random(25),
["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r"
,"s","t","u","v","w", "x","y","z"]).

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


More information about the Gc mailing list