close Warning: Can't synchronize with repository "(default)" (/project/cmucl/public_html/git/cmucl.git does not appear to be a Git repository.). Look in the Trac log for more information.

Opened 13 years ago

Closed 13 years ago

#6 closed defect (fixed)

GCed items in weak hash tables are still accessible (with random junk)

Reported by: rtoy Owned by: somebody
Priority: major Milestone:
Component: Core Version: 19c
Keywords: Cc:


Consider this simple transcript:

* (defvar *ht* (make-hash-table :weak-p t))
* (setf (gethash (list 1) *ht*) (list 2))
* *ht*
#<EQL hash table, 1 entry>
* (prog1 t (make-list 1000000))
* (gc :full t)
* *ht*
#<EQL hash table, 0 entries>
* (maphash #'(lambda (k v) (format t "~S -> ~S~%") k v) *ht*)

This is totally bogus. I think the problem is that when GC cleans up the weak entry, it doesn't fill in the entry in the table with the empty value. Instead it remains, and ends up pointing to random objects in memory.

Change History (1)

comment:1 Changed 13 years ago by rtoy

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in snapshot 2006-08.

Note: See TracTickets for help on using tickets.