[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

array garbage collection.



It is very easy to illustrate the bug, I put a file which did in
L;GCBIB BUG. Somebody deleted it though. Here it is:

(ARRAY K NIL 10) ; a NON-GC array for looking at things.
(DO ((A (*ARRAY NIL T 10)))
    (T
     (STORE (ARRAYCALL T A 0) A) ; array points to itself.
     (STORE (K 0) A)
     ()))
(PROGN (STORE (K 1) (*ARRAY NIL T 10)) ())

(K 0) ; ok.
(K 1) ;
()()()    ; Clear the value of *

(GC)
(K 1) => dead array. ; ok.
(K 0) => live array. ; the sucker didn't get GC'd.

If you look at the code for GC-marking of the ARRAY datatype
you will see that it can't possibly garbage collect the array in (K 0).
No matter how many times you GC.

Anyway, the body of a HUNK is marked correctly, I don't really see why
the body of an ARRAY could be that much more difficult to handle.
I'll admit the GC code is a bit "tight" as far as register-saving
conventions, etc., so it will take a bit of effort to figure out how to
change the code. But with all the work being put into maclisp lately
it is a shame to see fundamental and fixable bugs simply ignored.

-gjc

p.s. This bug should be mentioned in the documentation for *ARRAY.