[Zope] Zope memory usage out of control

Michael Bernstein webmaven@lvcm.com
Wed, 07 Feb 2001 07:46:01 -0800


Ron Bickers wrote:
> 
> After finally studying the Photo code, I discovered that the different sized
> images are each stored as object attributes (strings using StringIO), not as
> separate Image objects.  So each object has about 6 different strings, each
> the length of the image of that display size.
> 
> It seems that this type of object would cause Zope to eat my memory.  Can
> someone verify that this would do it?  I'll be a happy camper if this is the
> problem.  I can change the Photo product to store them as Image objects and
> hopefully get my memory back.

Ron,

The change you've proposed would have precisely the effect
you want.

I've been contemplating writing a new product using
ZPatterns to replace the Photo Product for exactly this
reason.

Here are my thoughts so far:

ArchiveImageFile ZClass
 - subclasses Image and DataSkin
 - stores a single image size
 - (receives original image data and resizing settings,
   generates specific size with PIL. Or receives resized
   image data?)

ArchiveImageFiles Specialist
 - instantiates and stores ArchiveImageFile objects
 - I *think* that this should receive a single copy
   of the original file data, and a list of settings,
   and return the appropriate object references after
   instantiation of the different ArchiveImageFile
   objects

ArchiveImage ZClass
 - subclasses DataSkin
 - contains metadata about the ArchiveImage, and
   pointers to the appropriate ArchiveImageFile objects
 - has *specific* sizing settings for ArchiveImageFile
   object instantiation (can be restored to the default
   settings from ArchiveImages)

ArchiveImages Specialist
- instantiates, stores, indexes and searches ArchiveImage
objects
- maintains the *default* sizing settings for
ArchiveImageFile
  object instantiation

The question right now is, where does the PIL code for
creating the
differently sized versions go. Does the ArchiveImages
specialist iterate
over the list of settings, generating a different version to
hand off to
ArchiveImageFiles, or does it hand off the original file
data and the
settings to each ArchiveImageFile and then get references
back for the
individual versions to attach to the ArchiveImage?

Ponder.

Michael Bernstein.