From: Steve Long
Subject: Setting and Retrieving from Hash Table
Date: 
Message-ID: <BA42573B.2334%sal6741@hotmail.com>
Pardon me if I'm not providing enough info or seem too cryptic:

Environment: ACL as packaged with ICAD v7.2.

I'm using a top-level EQUAL hash-table HT to cache a list of lists of the
form 

(((#s(STRUCT-A)) ;first element of list has only one value
  (#s(STRUCT-A) #s(STRUCT-B))
  (#s(STRUCT-A) #s(STRUCT-B))
  ...) 
 ...)

or LIST-OF-LISTS for short,

which is a list of list of struct instances; each instance is cached to a
hash-table for type STRUCT-A and STRUCT-B, respectively, and is known to be
stable (i.e., has shown no sign of being corrupted.) Each element of the
table is keyed on a list of two integers, INT-1 and INT-2. Each list may be
as short as one or as many as 5000. I perform an operation that generates
the lists and does

(format t "~%length in = ~a" (length LIST-OF-LISTS))
(setf (gethash (list INT-1 INT-2) HT) LIST-OF-LISTS)
(format t "~%length in = ~a" (length (gethash (list INT-1 INT-2) HT)))

to show the length of LIST-OF-LISTS before and after inserting into HT. The
before and after length values printed to the buffer are always the same.

However, if I do

(length (gethash (list INT-1 INT-2) HT))

immediately after the function has completed, the length value will
sometimes be less, with up to half of the end of LIST-OF-LISTS deleted; the
frequency of discrepancy seems to increase with the length of LIST-OF-LISTS.

Is there anything weird about hash-tables, lists, and/or garbage collection
that I should be worried about?


Regards,

Steve Long...

From: Barry Margolin
Subject: Re: Setting and Retrieving from Hash Table
Date: 
Message-ID: <1sgT9.6$gr1.561@paloalto-snr1.gtei.net>
In article <·····················@hotmail.com>,
Steve Long  <·······@hotmail.com> wrote:
>However, if I do
>
>(length (gethash (list INT-1 INT-2) HT))
>
>immediately after the function has completed, the length value will
>sometimes be less, with up to half of the end of LIST-OF-LISTS deleted; the
>frequency of discrepancy seems to increase with the length of LIST-OF-LISTS.
>
>Is there anything weird about hash-tables, lists, and/or garbage collection
>that I should be worried about?

Does the function perform any destructive list operations after it has
stored LIST-OF-LISTS in the hash table?

-- 
Barry Margolin, ······@genuity.net
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
From: Kaz Kylheku
Subject: Re: Setting and Retrieving from Hash Table
Date: 
Message-ID: <cf333042.0301091127.6b7bab64@posting.google.com>
Barry Margolin <······@genuity.net> wrote in message news:<···············@paloalto-snr1.gtei.net>...
> In article <·····················@hotmail.com>,
> Steve Long  <·······@hotmail.com> wrote:
> >However, if I do
> >
> >(length (gethash (list INT-1 INT-2) HT))
> >
> >immediately after the function has completed, the length value will
> >sometimes be less, with up to half of the end of LIST-OF-LISTS deleted; the
> >frequency of discrepancy seems to increase with the length of LIST-OF-LISTS.
> >
> >Is there anything weird about hash-tables, lists, and/or garbage collection
> >that I should be worried about?
> 
> Does the function perform any destructive list operations after it has
> stored LIST-OF-LISTS in the hash table?

Such as, for instance, using the SORT function?
From: Steve Long
Subject: Re: Setting and Retrieving from Hash Table
Date: 
Message-ID: <BA443072.23AD%sal6741@hotmail.com>
On 1/9/03 11:27 AM, in article
····························@posting.google.com, "Kaz Kylheku"
<···@ashi.footprints.net> wrote:

> Barry Margolin <······@genuity.net> wrote in message
> news:<···············@paloalto-snr1.gtei.net>...
>> In article <·····················@hotmail.com>,
>> Steve Long  <·······@hotmail.com> wrote:
>>> However, if I do
>>> 
>>> (length (gethash (list INT-1 INT-2) HT))
>>> 
>>> immediately after the function has completed, the length value will
>>> sometimes be less, with up to half of the end of LIST-OF-LISTS deleted; the
>>> frequency of discrepancy seems to increase with the length of LIST-OF-LISTS.
>>> 
>>> Is there anything weird about hash-tables, lists, and/or garbage collection
>>> that I should be worried about?
>> 
>> Does the function perform any destructive list operations after it has
>> stored LIST-OF-LISTS in the hash table?
> 
> Such as, for instance, using the SORT function?

Thanks to all for the assistance.

Yes, just prior to your post I discovered that an op using STABLE-SORT was
damaging my list on retrieval (there is different behavior between
MCL where I did the original development and my port to ACL with regard to
this). There is a function SAFE-SORT that comes with the ICAD product that I
should have used.

This was a simple network routing function using the Lee algorithm.

Regards,

Steve Long
From: Steve Long
Subject: Re: Setting and Retrieving from Hash Table
Date: 
Message-ID: <3E1DB1EC.C7F8DA6@kitts.ca.boeing.com>
Barry Margolin wrote:
> 
> In article <·····················@hotmail.com>,
> Steve Long  <·······@hotmail.com> wrote:
> >However, if I do
> >
> >(length (gethash (list INT-1 INT-2) HT))
> >
> >immediately after the function has completed, the length value will
> >sometimes be less, with up to half of the end of LIST-OF-LISTS deleted; the
> >frequency of discrepancy seems to increase with the length of LIST-OF-LISTS.
> >
> >Is there anything weird about hash-tables, lists, and/or garbage collection
> >that I should be worried about?
> 
> Does the function perform any destructive list operations after it has
> stored LIST-OF-LISTS in the hash table?
> 
> --
> Barry Margolin, ······@genuity.net
> Genuity, Woburn, MA
> *** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
> Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

No destructive operations are performed after insertion.

Steve Long
From: Barry Margolin
Subject: Re: Setting and Retrieving from Hash Table
Date: 
Message-ID: <8lkT9.26$gr1.2272@paloalto-snr1.gtei.net>
In article <················@kitts.ca.boeing.com>,
Steve Long  <·······@hotmail.com> wrote:
>Barry Margolin wrote:
>> Does the function perform any destructive list operations after it has
>> stored LIST-OF-LISTS in the hash table?
...
>No destructive operations are performed after insertion.

Then I think you'll have to post some actual code for us to review.  Either
that, or you should single-step your program and watch for when the list
changes.

-- 
Barry Margolin, ······@genuity.net
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.