Memory Usage

30 Mar 2006
Tags: VitaminSEE

So, later tonight, I’ll be making a release of VitaminSEE that should fix most of the current memory leaks, so I can go off and make new ones for the next version.

But right now, I want to talk about the conditions under which VitaminSEE consumes ridiculous amounts of memory (which won’t be fixed in this release). You may have noticed that on folders with a large number of image files, VitaminSEE will consume really large amounts of memory.

For example, I have an “Unsorted” folder with 1,666 images in it. VitaminSEE starts from a resting memory position of 8 megabytes. After giving VitaminSEE a few moments to load all the thumbnails, Activity Monitor tells me that VitaminSEE is using 25 megs of real memory. Not optimal, but more then acceptable. After scrolling from the first file in the folder to the last file, VitaminSEE’s memory consumption jumps all the way up to 122 megabytes. Note that it already had the thumbnails in memory before the jump.

From what I can make out from MallocDebug, it appears that the implementation of either NSBrowser or NSMatrix in Cocoa render their contents into an NSImage offscreen, and then copy that cached version onto the screen.

Solving this will require me to do one of the two things:

  • Find a magic way to tell whatever class is at fault to not cache things this way (Quick, unlikely)
  • Look at other controls and see if I can coerce them to do what I want to do.
  • Write my own control that doesn't do things this way. (Hard, would take a long time)