[racket-dev] weird (memory?) bug using (dis)similar require mechanisms

From: Marijn (hkBst at gentoo.org)
Date: Fri Sep 9 06:29:13 EDT 2011

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi list,

this racket bug was discovered when I was trying out geiser which
starts programs in a way that exposes this bug. The program starts
correctly but none of the buttons work (or only reserve screen space)
and it is hard to terminate the program. I got the impression that a
lot of memory was being allocated in a loop.

The bug manifests itself when starting racket from the command line
and copying into the resulting repl (require "./test1.rkt"). But doing
either of:
$ racket -e '(require "./test1.rkt")'
$ racket <<< '(require "./test1.rkt")'
works fine.

Test program to exhibit the bug:

#lang racket/gui

(define f (new frame% [label "List Editor"]))

(define items (new vertical-pane% (parent f)))

(define (create-item val parent)
  (define v (new vertical-panel% (parent parent)))
  (define ins (new button% (parent v) (label "insert")
                   (callback (λ (b e) (create-item "0" items))) ))
  (define h (new horizontal-pane% (parent v)))
  (define t (new text-field% (parent h) (label "") (init-value val)))
  (define del (new button% (parent h) (label "del")
                   (callback (λ (b e) (send parent delete-child v))) ))
  v)

(for-each (λ (v) (create-item v items)) '("1" "2" "3"))

(new button% (parent f) (label "append") (callback (λ (b e)
(create-item "0" items))))

(send f show #t)

Marijn
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk5p6nkACgkQp/VmCx0OL2zqKACeK7P3FAQFTZ1aEd+O+X+/wWWA
QtAAoKgi7zNggcdW8zLC0+YXpmX6l4Bh
=yfHI
-----END PGP SIGNATURE-----


Posted on the dev mailing list.