[plt-scheme] draw-bitmap causes memory leak?
There seems to be a memory leak in draw-bitmap when using masks. I've
narrowed it down to the following small test case:
(define black (make-object color% 0 0 0))
(define image (make-object bitmap% "image.bmp" 'bmp #f))
(define image-mask (make-object bitmap% "image-mask.bmp" 'bmp #f))
(define simple-canvas
(class canvas%
(override
on-paint)
(init-field parent)
(define (on-paint)
(define dc (send this get-dc))
(send dc draw-bitmap image 0 0 'solid black image-mask))
(super-instantiate (parent))))
(define win (make-object frame% "Some frame"))
(define canvas (make-object simple-canvas win))
(send win resize 300 300)
(send win show #t)
(define runner
(thread (lambda ()
(let loop ()
(send canvas on-paint)
(sleep 0.02)
(loop)))))
When running the above with DrScheme 205 (on Solaris, with or without
debugging or profiling) the memory consumption rapidly grows and the
machine starts to swap heavily. So, there seems to be a memory leak,
either in the MrED Graphical Toolbox or the underlying WxWindows code...
Furthermore the get/set-loaded-mask methods do not seem to have any
affect on the problem. However, when using gif:s, instead of bmp:s or
jpg:s, the leak vanishes.
To me, this seems like a memory leak, or am I missing something?
--Tord Svensson