[Openmcl-devel] strange(?) hash-table-count on weak hash table

Jared C. Davis jared at cs.utexas.edu
Thu Jun 19 06:36:00 PDT 2014


Thanks Gary

Cheers,
Jared

On Thu, Jun 19, 2014 at 1:13 AM, Gary Byers <gb at clozure.com> wrote:
> It's a bug; it should be fixed in the trunk in r16119.
>
>
> On Wed, 18 Jun 2014, Jared C. Davis wrote:
>
>> Hi,
>>
>> I was experimenting with weak hash tables and have run into something I
>> don't
>> understand.  Here's a small example, taken on 1.10-dev-r16074M-trunk
>> (LinuxX8664).
>>
>> ------------------
>>
>> (defparameter *ht* (make-hash-table :weak :key :test 'eq))
>> (defparameter *key* (cons 1 2))
>> (setf (gethash *key* *ht*) 17)
>>
>> (hash-table-count *ht*) ;; 1, as I expected
>> (gc)
>>
>> (hash-table-count *ht*) ;; 1, as I expected since *key* is obviously
>> reachable
>>
>> nil ;; try to clear out *, **, ***
>> nil
>> nil
>>
>> (gc)
>> (hash-table-count *ht*) ;; 1, as I expected since *key* is still reachable
>> (setf *key* nil)        ;; The (cons 1 2) should now be unreachable,
>> right?
>> (gc)                    ;; So this should free the hash table entry
>>
>> (hash-table-count *ht*) ;; 2 --- er, what the heck?!?
>>
>> ------------------
>>
>> I had expected the final line above to report 0 instead of 2.  I wouldn't
>> have
>> been entirely surprised by a count of 1, but how in the world did the
>> count
>> increase?  Is this expected?
>>
>> Thanks,
>> Jared
>>
>>
>> --
>> Jared C. Davis <jared at cs.utexas.edu>
>> 11410 Windermere Meadows
>> Austin, TX 78759
>> http://www.cs.utexas.edu/users/jared/
>> _______________________________________________
>> Openmcl-devel mailing list
>> Openmcl-devel at clozure.com
>> http://lists.clozure.com/mailman/listinfo/openmcl-devel
>>
>>
>



-- 
Jared C. Davis <jared at cs.utexas.edu>
11410 Windermere Meadows
Austin, TX 78759
http://www.cs.utexas.edu/users/jared/



More information about the Openmcl-devel mailing list