[plt-scheme] bitmap error from image operation in 207

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sun Aug 29 09:38:01 EDT 2004

At Sat, 28 Aug 2004 19:41:27 -0400, Kathi Fisler wrote:
> I'm trying to write some simple image animations in 207 using
> Matthias' image.ss library from the TeachScheme 2 workshop.  The
> current one tries to drop a ball from a starting position on a window
> down to the bottom of the window.  Part way through, I get an error:
> 
>      set-bitmap in memory-dc%: bad bitmap: #<struct:bitmap%>
> 
> The error shows up almost every time I run the code, but the animation
> progresses a different amount each time.

This error is a combination of problems:

 * The allocation of a bitmap is not sufficiently well exposed to the
   garbage collector; allocating many bitmaps should trigger a GC, but
   it doesn't in v207.

 * The image library in v207 wasn't designed to support animation, and
   it creates far more bitmaps than are needed in principle (or in
   v208).

The only half-solution I know is to throw in explicit a call to
`collect-garbage' --- though, of course, there's often not a good place
to insert the call.

Matthew



Posted on the users mailing list.