It seems that if I unintern a symbol without first setting its value
to nil, the value is never GC'd.  For example, in a fresh CMUCL
post-18e (2003-08-15), with a first gc to flush garbage from
initialization/startup:

(gc :full t)
; [GC threshold exceeded with 27,760,320 bytes in use.  Commencing GC.]
; [GC completed with 5,547,208 bytes retained and 22,213,112 bytes freed.]
; [GC will next occur when at least 133,547,208 bytes are in use.]
NIL
* (defparameter *a* (random-df-vec 5000000))
*A*
* (unintern '*a*)
T
* (gc :full t)
; [GC threshold exceeded with 45,581,744 bytes in use.  Commencing GC.]
; [GC completed with 45,544,104 bytes retained and 37,640 bytes freed.]
; [GC will next occur when at least 173,544,104 bytes are in use.]
NIL
* (gc :full t)
; [GC threshold exceeded with 45,548,064 bytes in use.  Commencing GC.]
; [GC completed with 45,546,544 bytes retained and 1,520 bytes freed.]
; [GC will next occur when at least 173,546,544 bytes are in use.]
NIL
* (gc :full t)
; [GC threshold exceeded with 45,550,504 bytes in use.  Commencing GC.]
; [GC completed with 45,546,528 bytes retained and 3,976 bytes freed.]
; [GC will next occur when at least 173,546,528 bytes are in use.]
NIL

etc.  I can gc a large number of times, but the vector is not
collected.  This is not a huge practical problem, because if I setf
*a* to nil before uninterning, the collection happens, but I am
curious as to how the large vector could still be accessible. 

Note also that I don't *think* this is a REPL issue, because when I do
a defparameter, the actual value is never visible to the REPL.  For
instance, if I continue with

(defparameter *b* (random-df-vec 5000000))
*B*
* (setf *b* nil)
NIL
* (gc :full t)
; [GC threshold exceeded with 85,580,920 bytes in use.  Commencing GC.]
; [GC completed with 45,548,240 bytes retained and 40,032,680 bytes freed.]
; [GC will next occur when at least 173,548,240 bytes are in use.]
NIL
* 

the second vector is collected immediately.

Any ideas what is going on?

Cheers,

rif


Reply via email to