Sequence elements not garbage-collected when number-of-elements is modified
Created by: genworks
(Please see code example from Issue #68 (closed))
(make-self 'huge-boxes-sequence)
gdl-user> (pprint (glisp:room-report))
(:new-free-cons 1019 :new-used-cons 1613 :new-free-other 29936272
:new-used-other 119776 :old-free-cons 736 :old-used-cons 1029473
:old-free-other 33451536 :old-used-other 32475008)
gdl-user> (dotimes (n 20) (the (set-slot! :number-of-boxes 20000))
(mapsend (the boxes) :center)
(the (set-slot! :number-of-boxes 10000))
(mapsend (the boxes) :center))
gdl-user> (pprint (glisp:room-report))
(:new-free-cons 1019 :new-used-cons 6505370 :new-free-other 107370384
:new-used-other 72025632 :old-free-cons 514 :old-used-cons 19165857
:old-free-other 1371136 :old-used-other 211685968)
Imported comments:
By genworks on 2013-02-01 04:04:41 UTC
Fixed by enhancing dependency-tracking to track elements of sequences with respect to the sequence's number-of-elements.
(make-self 'huge-boxes-sequence)
gdl-user> (glisp:room-report)
(:new-free-cons 1019 :new-used-cons 1565 :new-free-other 231540304
:new-used-other 145248 :old-free-cons 483 :old-used-cons 1030745
:old-free-other 326332808 :old-used-other 32518200)
gdl-user> (dotimes (n 20) (the (set-slot! :number-of-boxes 20000))
(mapsend (the boxes) :center)
(the (set-slot! :number-of-boxes 10000))
(mapsend (the boxes) :center))
gdl-user> (glisp:room-report)
(:new-free-cons 1019 :new-used-cons 450260 :new-free-other 222520136
:new-used-other 5552744 :old-free-cons 236 :old-used-cons 1032011
:old-free-other 326276256 :old-used-other 32566560)
By genworks on 2013-08-13 14:36:20 UTC
This issue is being re-opened because the "fix" can cause a subtle issue in rare circumstances. A child object can become spuriously "orphaned" after doing a set-slot! --- that is, it will become unbound, and a new object will be instantiated on-demand, losing any bashing which happened in the child. The "fix" will be reverted in devo branch which will be merged into master branch for next release.