[CM] How to iterate through a hash-table in C?

Iain Duncan iainduncanlists at gmail.com
Tue Dec 8 11:17:40 PST 2020


Thanks Bill. I have two cases, one is that I am making a new hashtable
after accessing a Max dictionary from C, and the other reading a hashtable
and turning the contents into a Max dictionary. So in the case of creating
a new hash-table, I guess it will not be protected?

thanks
iain

On Tue, Dec 8, 2020 at 10:16 AM <bil at ccrma.stanford.edu> wrote:

> Objects created in C are treated the same as those in Scheme by the GC.
> There is a lag between when an object is created and when it is first
> liable to be GC'd (set indirectly by GC_TEMPS_SIZE in s7.c).  The
> hash-table
> traversal creates a cons cell for each key/value pair, so if your table
> has lots of entries, you need to gc protect at least the iterator.
> I assume your hash-table is already protected.  Don't turn off the GC.
> Unless you want to keep the entries returned by s7_iterate, you don't
> need
> to gc protect them.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cm-mail.stanford.edu/pipermail/cmdist/attachments/20201208/43115d46/attachment.html>


More information about the Cmdist mailing list