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

Re: Changing the Heap Size at run time



On 08 Feb 1994, Bill St. Clair supplied a function to grow the
size of the mac heap, in reply to Karsten Poeck. Instead of
Bill's function:
(defun ensure-mac-heap-space (minimum)
  (let ((p (#_NewPtr minimum)))
    (unless (%null-ptr-p p)
      (#_DisposePtr p)
      t)))

I used the following function, and wondered whether the two were equivalent?

(defun check-request (minimum)
   ;; checks whether there is enough space left on the heap
   ;; to create an object of size minimum bytes
   ;; returns three values: 
   ;;    t when the request can be satisfied, otherwise nil
   ;;    the actual amount available
   ;;    the amount requested
   (let ((actual (require-trap #_compactmem request)))
       (values
          (< actual request)
          actual
          request)))

mark