[Oberon] Array Index Out Of Range in ORG.FindPtrFlds
Michael Schierl
schierlm at gmx.de
Sat Oct 23 15:05:35 CEST 2021
Hello,
Am 23.10.2021 um 12:22 schrieb Jörg:
>> Am 18.10.2021 um 08:52 schrieb Andreas Pirklbauer <andreas_pirklbauer at yahoo.com>:
>> ELSIF typ.form = ORB.Array THEN
>> s := typ.base.size;
>> FOR i := 0 TO typ.len-1 DO FindPtrFlds(typ.base, i*s + off, dcw) END (*<--------*)
> Ich bin mir nicht ganz sicher, aber sollte es nicht so heissen?
>> ELSIF typ.form = ORB.Array THEN FindPtrFlds(typ.base, off, dcw) END
I don't think so. The list of pointer fields in the type descriptor is
used by the garbage collector to know which addresses to follow in the
mark phase. And when a RECORD contains an ARRAY of anything that
contains pointers, the pointers have to be followed for each element of
the array.
So, a record that contains an array of 160 things that include pointers
will need at least 160 pointers in the type descriptor.
The only possible fix I see (without modifying the compiler) would be to
split the array into either an array of smaller chunks (each allocated
on the heap) or a linked list. So that each chunk contains a smaller
number of pointers.
Modifying the compiler might be the better solution, though.
Regards,
Michael
More information about the Oberon
mailing list