[racket] Memory consumption grows non-stop when re-loading a file and reusing a struct
After defining and creating a struct with a `gen:custom-write', if one
reenters the file and asks for an element of this struct, the REPL
freezes and memory consumption grows non-stop.
Here are the steps:
$ cat "foo.rkt"
#lang racket
(struct foo
(n)
#:methods
gen:custom-write
((define (write-proc self out mode)
(case mode
((#t) (write (foo-n self) out))
((#f) (display (foo-n self) out))
(else (print (foo-n self) out mode))))))
$ racket
Welcome to Racket v5.3.5.
> (enter! "foo.rkt")
> (define bar (foo 42))
> (foo-n bar)
42
> ; change and save foo.rkt
(enter! "foo.rkt")
[re-loading /tmp/foo.rkt]
> (foo-n bar)
terminate break
$
In the steps, I killed racket.
I'm new to #:methods, so I might be doing something horribly wrong.