If I have this struct:
(defstruct foo
(x 0 :type 'fixnum))
and this array:
(defvar arr (make-array 0 :element-type 'foo :adjustable t :fill-pointer 0))
and then do the following:
(vector-push-extend (make-foo) arr)
(setf (fill-pointer arr) 0)
Is the foo in the array now a candidate for GC?
I understand from the CLHS that it is not active, but am unsure of the implications of that state.
Elements that are beyond the fill pointer are still accessible, and will not be garbage collected. Elements beyond the fill pointer aren't printed when you print the array, and they'll be overwritten if you use ARRAY-PUSH (since it uses the fill pointer to determine where to add the new element), but other operations on the array treat them normally.
For instance, the specification of AREF says:
arefignores fill pointers. It is permissible to usearefto access any array element, whether active or not.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With