[Ecls-list] ECL's weak-hash tables

Zajcev Evgeny lg.zevlg at gmail.com
Thu Apr 4 11:03:27 UTC 2013


Hello there! Thanks for the excelent software

I'm quite confused about weak hash tables in ECL.

I have simple test program:

.-----[~/tmp/whash.lsp
|  (defvar gg (make-hash-table :weakness :value))
|  
|  (loop repeat 100 do
|    (setf (gethash (gensym) gg)
|          (loop repeat 10 collect (random 100))))
|  
|  #+ecl (format t "Has weak hash: ~A~%" (not (null (member :ecl-weak-hash *features*))))
|  (format t "Before GC: ~A~%" (hash-table-count gg))
|  #+sbcl (sb-ext:gc :full t)
|  #+ecl (si:gc t)
|  (format t "After GC: ~A~%" (hash-table-count gg))
`-----

Its ouput from SBCL

.-----[$ sbcl --script ~/tmp/whash.lsp
|  Before GC: 100
|  After GC: 0
`-----

and from ECL

.-----[$ ecl -shell ~/tmp/whash.lsp
|  Has weak hash: T
|  Before GC: 100
|  After GC: 100
`-----

ECL's results looks a little awkward.  Does weak hash tables really
work in ECL?  Or do I misuse them in some manner?

thanks!

-- 
lg




More information about the ecl-devel mailing list