Credit to @samth on the Discord for noticing that I did not use 
`_bytes/nul-terminated` on Racket CS byte strings. Doing so fixed the issue. 
Thanks, Sam!

On 6/2/21 10:21 AM, Sage Gerard wrote:

> Hi all,
>
> Consider this small FFI that currently works only on GNU/Linux.
>
> https://github.com/zyrolasting/xiden/blob/libcrypto/crypto.rkt
> https://github.com/zyrolasting/xiden/blob/libcrypto/crypto/crypto.c
>
> `raco test` intermittently fails this module with "invalid memory reference. 
> Some debugging context lost". I can silence the error by commenting out all 
> use of `valid?` in the tests (starts on line 413), which allows me to blame 
> one of the verification functions. However, I do not understand the nature of 
> the problem well enough to know where exactly the problem occurred, or what 
> to do when I find it.
>
> My current guess is that I passed a pointer to GC-managed memory, and the 
> pointer referenced an old location.
>
> Besides continuing to throw prints around, how should I go about debugging 
> this?
>
> --
> ~slg

--
~slg

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/a7754519-5b39-a2bb-2d6a-958dac6eedfe%40sagegerard.com.

Reply via email to