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

Re: Larger Mac Heap than Default



At 6:06 PM 4/14/95, CHRISTOPHER ELIOT wrote:
>I'm trying to manipulate some large graphic images (1 meg +)
>and would like to know if there is some way to make MCL keep
>more open room in the Mac heap, rather than in the Lisp heap.

The Mac heap will automatically grow to accomodate #_NewPtr and
#_NewHandle (etc.) requests. It never shrinks, however, so once
you've allocated Mac Heap memory, your Lisp heap is smaller until
you quit and restart MCL. MCL's "LSIZ" resource contains information
about the initial heap sizes. You can also specify them with
the :memory-options keyword argument to save-application, which
I believe is documented in MCL's release notes. I'll send you
details if you can't find it.

Every time the Mac heap automatically grows requires a GC. Hence,
growing it in small increments takes a long time. I use the following
function to ensure that the Mac heap has enough space for a pointer
of size bytes with one or no GCs:

(defun enlarge-macheap (size)
  (let ((bytes (#_FreeMem)))
    (unless (>= bytes size)
      (let ((p (#_NewPtr bytes))
            (p2 (#_NewPtr (- size bytes))))
        (unless (%null-ptr-p p2)
          (#_DisposPtr p2))
        (unless (%null-ptr-p p)
          (#_DisposPtr p)))))
  (#_FreeMem))