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

Re: Changing the Heap Size at run time

At  1:00 PM 2/8/94 +0000, Karsten Poeck wrote:
>Can I change the size of the Mac Heap at run time?
>For example if (room) gives the following
>There are at least 4876488 bytes of available RAM.
>                  Total Size            Free               Used
>Mac Heap:      1042180 (1017K)       331904 (324K)       710276 (694K)
>Lisp Heap:    14659584 (14316K)      4544584 (4438K)     10115000 (9877K)
> (Static):      528384 (516K)
>Stacks:         208960 (204K)
>can I increase the MacHeap to 2000K at run time? I know how to do that with
>save-application and the lsiz resource at save-application time, but this
>is not what I want.
>Since Lisp increases the Mac Heap size when I load many pictures this
>should be possible but #'(Setf Ccl::%Dynamic-Heap-Size) isn't defined.
>We want to do this since we have to integrate a Database (DTF) into a MCL
>application that needs space on the mac-heap, but only if we really use the
>DTF interface. If we allocate the heap size at save-application time the
>heap size is wasted even if we don't use DTF.

MCL will automatically grow the Mac heap as necessary to satisfy
requests. As you have noticed, it does this by shrinking the Lisp heap.
There is no function to explicitly set the heap size, but you can make
sure there is sufficient room by allocating and then freeing a pointer.
The following function will return true if it manages to allocate
a pointer of the given "minimum" size. It will grow the Mac heap if
necessary and if doing so allows it to satisfy the request.

(defun ensure-mac-heap-space (minimum)
  (let ((p (#_NewPtr minimum)))
    (unless (%null-ptr-p p)
      (#_DisposePtr p)