Squeak DisplayScreen Bitmap Stationary?

Ian Piumarta ian.piumarta at inria.fr
Mon Aug 19 11:41:23 UTC 2002


On Mon, 19 Aug 2002, Marcel Weiher wrote:

> will Squeak's DisplayScreen bitmap be moved around during garbage 
> collection?

Yes.

> If so, is there a way to be informed of this?

Indirectly, yes.

Just check the dispBitsIndex that's passed to ioShowDisplay.  If it isn't
the same as the previous one then it's (err...) moved (duh... ;-).

> I think there is a way of using the DisplayScreen's bits directly for
> display (in case they match), without copying them around multiple
> times, but I think I'd need to know when the address changes.

Take a look at sqXWindow.c which uses the contents of Display's Bitmap
directly whenever it can.  The static variable stDisplayBitsIndex in
ioShowDisplay hangs on to the most recently known address of that object,
and the global stDisplayBitmap is either the bits in the real Bitmap or
memory allocated outside the image if for some reason we can't reuse the
Bitmap directly.

There are a few details to pay attention to, e.g.: see redrawDisplay()
(which extracts the Bitmap from the oop returned by displayObject(), a
function covertly imported from Interpreter) and ioShowDisplay() (which
has to make sure external code never tries to free() the display memory
e.g., when X11 destroys an XImage that's pointing directly at the Bitmap
inside Display).

Ian




More information about the Squeak-dev mailing list