[Openmcl-devel] Hash Table anomaly -- hash-table-size decreases - wondering how this can happen

Glenn Iba giba at alum.mit.edu
Mon Jan 5 14:10:59 PST 2015


Hi Madhu,

   I was confused by your previous messages.  You talked about patching and
re-building -- all way over my head :(
Then you said to ignore it since the kludge didn't work (or something like
that).

So your followup suggestion seems a lot clearer (though I haven't a clue
what :lock-free is about - couldn't find documentation on it).

I have now tried the experimental code snippet first proposed by Raymond
Wiker, but with (make-hash-table :lock-free nil):

(let ((h (make-hash-table :size 100000 :lock-free nil)))
   (dotimes (i (truncate (hash-table-size h) 2))
     (setf (gethash i h) i))
   (format t "~%before CLRHASH, hash-table-size = ~a" (hash-table-size h))
   (clrhash h)
   (format t "~%after CLRHASH, hash-table-size = ~a" (hash-table-size h))
   (dotimes (i (truncate (hash-table-size h) 2))
     (setf (gethash i h) i))
   (hash-table-size h))

before CLRHASH, hash-table-size = 100005
after CLRHASH, hash-table-size = 100005
100005

This seems to fix the problem of the hash-table shrinking.  And Gail
Zacharias posted that there was a bug in CLRHASH for :lock-free hash-tables
that she'd work to fix.  The ticket she referenced talks about how the bug
only occurs in :lock-free hash-tables.

I'm happy to use the :lock-free NIL hash-tables for now, but I'm wondering
what the differences are, if any, in how my hash-tables
should behave with :lock-free nil.   The :lock-free business is apparently
CCL specific, so a pointer to documentation would be
helpful [or even better, a description of how to FIND it in the
documentation so I can look for other things without bothering people :) ]

Thanks,
--Glenn

On Mon, Jan 5, 2015 at 11:23 AM, Madhu <enometh at meer.net> wrote:

>
> Maybe you overlooked or ignored my message on the ccl list, but did
> you try running your code or tests after creating the hashtables
> specifying :LOCK-FREE NIL ? eg.
>
>         (make-hash-table :size 100000 :LOCK-FREE NIL)
>
> --- Madhu
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20150105/5cd90287/attachment.htm>


More information about the Openmcl-devel mailing list