[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Lisp heap



At  6:27 PM 9/15/94 -0400, bright@ENH.NIST.GOV wrote:
>Hi out there!
>
>I've got a lisp heap memory problem when running my image processing
>system.  It goes like this,
>where mac heap and lisp heap refer to the free memory, i.e., the available
>space on the respective heaps:
>* load a large image array - Lisp heap shrinks.  That's ok.  (Monitored
>heaps with (room)).
>* display the image (make a pixmap, etc). - Mac heap shrinks.  Ok.
>* display it again. - Mac heap steals room from Lisp heap.  Ok, but it
>doesn't give it back...
>* close one or both windows - Mac heap expands.  Mac heap does NOT give
>room back to Lisp heap - even when Lisp is gc'ing like mad.
>* get rid of arrays, ie., assign the global variables to nil.  Even unbind
>the global variables. - Lisp heap remains small or gains just a little
>room.
>
>The image arrays are referenced by global variables, and by slots in
>special windows.  When they are not needed any more, the windows are closed
>(and presumably the accessor functions disappear, and variables are set to
>nil so that hopefully the memory can be garbage collected.
>
>Does anyone have suggestions as to where I might look for the Lisp heap memory?

In MCL 2.0, once the Lisp heap has shrunk to make space for a larger
Mac heap, there's no going back. The only thing you can do is to
be careful about how much Mac heap you allocate. Your code appears
to be allocating (in the Mac heap) a large pixmap for each window.
Since each pixmap is just a copy of an array in the Lisp heap, you
may be able to get around this by copying the array to the pixmap
at each update event, then deallocating the pixmap. The only drawback
I can imagine is that this will make window updates too slow. If it is
not too slow, you can use even less Mac heap by using a fixed size of
pixmap and updating in multiple passes, e.g. if your window is 500x500
pixels, you could use a 250x250 pixmap 4 times: upper-left, upper-right,
lower-left, and lower-right.