[racket] Some problem with hash-update!

From: Evgeny Odegov (oev-racket at sibmail.com)
Date: Mon Sep 15 23:43:24 EDT 2014

> Using `#:atomic? #t` disables Racket thread switches, but it doesn't
> disable GC.

> It's not so much about modification as referencing the memory ---
> either reading or writing --- across a potential GC.

Thank you! It's clear now.

> Now that I look closely, I think you need the `bytes-copy!` code that
> you have commented out. Otherwise, initializing a array will read past
> the end of the allocated byte string.
>
> For example,
>
>  (define-cstruct _foo ([a _int]
>                        [b (_string/locale/len 10000000)]))
>
>  (make-foo 0 "boo")
>
> crashes for me, because 10000000 is big enough that it reads past
> allocated regions. That example works if I uncomment your `bytes-copy!`
> use, which makes it return a byte string that is 10000000 bytes long.

Good example. I commented those lines to experiment and forgot about them.

Thank you for your help!


Posted on the users mailing list.