"invalid memory reference" issue

35 views
Skip to first unread message

hashim muqtadir

unread,
Mar 5, 2020, 7:07:48 AM3/5/20
to Racket Users
Hello,

I have some code that uses my library, "remap". It previously used to work, but in Racket CS 7.6, it fails saying "invalid memory reference.  Some debugging context lost".
Clicking the crosses in DrRacket gives this backtrace:

invalid memory reference.  Some debugging context lost

/home/hashim/racket/collects/racket/private/for.rkt: 2020:10
            (hash-set table key val))))

/home/hashim/racket/collects/racket/private/for.rkt: 1503:16
                  (let-values ([(fold-var ...) (let () expr1 expr ...)])
                  (values fold-var ...)))))]

/home/hashim/racket/collects/racket/private/for.rkt: 1543:38
                                      #'(let-values ([(fold-var ...)
                                                    (for/foldX/derived [orig-stx inner-recur nested? #f ()]
                                                      ([fold-var fold-var] ...)
                                                      next-k break-k final?-id
                                                      rest expr1 . body)])
                                        (if (and post-guard ... (not final?-id))
                                            (for-loop fold-var ... loop-arg ... ...)
                                            next-k)))

My tests, that use the library functions, seem to work, but for some reason when I'm building a hash from my structures.
The file found https://gitlab.com/hashimmm/remap/-/blob/96f1db518c4d9bb8f2da44ae403ab50332212c9c/issue.rkt is present in the "issue" branch in my repo and running this file in DrRacket will reproduce the problem.

From the file, removing the measurement-units table definition and its references fixes the problem (the memory error then no longer occurs).

Any ideas what's up with this? I'd be happy to provide more information to narrow this down, but I'm not really sure how.

Matthew Flatt

unread,
Mar 5, 2020, 1:42:34 PM3/5/20
to hashim muqtadir, Racket Users
I've pushed a repair for the development version of Racket CS. The
problem was related to computing a hash code of an object (i.e., an
instance of a class).

If you need a workaround to keep using the released version of Racket
CS, it may involve supplying explicit equality and hash-code functions
for your `Equal%` class.

Thanks for the report!
> --
> 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...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/afec7b07-7f96-4d7f-ac59-8eb54446
> 2709%40googlegroups.com.

hashim muqtadir

unread,
Mar 6, 2020, 6:01:12 AM3/6/20
to Racket Users
I decided to build Racket CS from github and it works. Thanks!
Reply all
Reply to author
Forward
0 new messages