Image Bloat: What can I do about it.

Maloney johnm at wdi.disney.com
Sat Feb 7 18:55:52 UTC 1998


Just adding methods and classes to the image causes it to grow only
very slowly. Your image bloat problems almost certainly have to do
with some global variable holding onto large objects such as
Forms. Here are some things to look for:

a. lots of open windows that are caching their images in Forms.
Every window does this by default, but uses only an 1-bit Form
the size of the window (for rapid repainting of the non-active
windows). However, since you are working on a drawing program,
it may keep its own cached Forms that are 8-bits or deeper.
Solution: close (not just collapse) any windows you aren't
using and see if that helps.

b. Workspace variables may be holding onto large objects.
Solution: For each existing Workspace window, create a new
one, copy the text of the old one into it, and close the
old workspace.

c. A global or class variable is holding onto large objects.
Solution: Set that variable to nil if you don't need to keep
the large object around (for example, if it can be re-created
somehow).

You can use the the "space left" submenu of the "help" screen
menu to find out if you are getting any space back.

A technique I frequently use is to enumerate all Forms and
display them with an expression like:

    (Form allInstances select: [:f | f bits size > 250])
	do: [:f | f display. (Delay forMilliseconds: 300) wait]

You'll see a lot fonts go by, but you may see some forms that
you recognize from your drawing program. If so, you can try to
figure out who's holding onto them and why. You can also
inspect one of these Forms and use the "objects referring to this object"
menu item to trace backwards (perhaps through a number of arrays,
collections, associations, and other objects) to find the ultimate
root of the undesired chain of reference.

Happy hunting!

	-- John

Re:
>I have run into another problem. My image is outgrowing my available memory:(
>
>My Mac Centris 610 with 24 meg is maxing out. I checked the size of my Squeak 1.3
>source files and they have all grown considerably. About this Mac says that
>Squeak is using over 15 meg, the system and my editor are taking up the rest.
>
>When I load my image, it takes much longer than it used to.
>
>I have been working on a port of the Draw80 drawing program from KCS and have 
>added a lot of code to my system and have worked on changes to a lot of methods.
>
>Is there anything I can do to reclaim some space?
>
>I continue to make progress on DrawSQ. I have a view open with a command menu and
>a toolbar. Selecting a tool works and I can use them, but the images that I
>create are not persistant. Something, somewhere is not working.
>
>If I can get some space back, I will continue debugging and try to get this
>thing working correctly.
>
>Thank You,
>
>John-Reed Maffeo





More information about the Squeak-dev mailing list