Comment 2 for bug 1446962

Revision history for this message
Jim Newton (jimka-issy) wrote :

I posted this already in comp.lang.lisp, but I'll re-post it here.

I have a program which demonstrates this issue.
Maybe I'm really allocating more memory than my machine has?

(defclass cell ()
  ((data :initarg :data)))

(defun test-allocate (x)
  (declare (optimize (safety 3) (debug 3) (space 0) (speed 0)))

  (let ((w 2562)
        (h 1602)
        (d 3))
    (let ((arr2d (make-array (list w h)))
          (arr3d (make-array (list w h d))))

      (dotimes (i w)
        (dotimes (j h)
          (let ((vec (make-array (list d))))
            (let ((value (make-instance 'cell :data vec)))
              (setf (aref arr2d i j) value)
              (dotimes (k d)
                (setf (aref vec k) x))))))

      (dotimes (i w)
        (dotimes (j h)
          (dotimes (k d)
            (setf (aref arr3d i j k) x))))

      (list arr2d arr3d))))

(test-allocate 3.1)

* Heap exhausted during garbage collection: 0 bytes available, 32 requested.
 Gen StaPg UbSta LaSta LUbSt Boxed Unboxed LB LUB !move Alloc Waste Trig WP GCs Mem-age
   0: 0 0 0 0 0 0 0 0 0 0 0 10737418 0 0 0.0000
   1: 0 0 0 0 0 0 0 0 0 0 0 10737418 0 0 0.0000
   2: 1515 0 0 0 14529 90 0 0 43 478264576 770816 2000000 0 0 2.1092
   3: 0 0 0 0 0 0 0 0 0 0 0 2000000 0 0 0.0000
   4: 0 0 0 0 0 0 0 0 0 0 0 2000000 0 0 0.0000
   5: 0 0 0 0 0 0 0 0 0 0 0 2000000 0 0 0.0000
   6: 0 0 0 0 1220 241 0 0 0 47874048 0 2000000 1092 0 0.0000
   Total bytes allocated = 1072272272
   Dynamic-space-size bytes = 1073741824
GC control variables:
   *GC-INHIBIT* = true
   *GC-PENDING* = true
fatal error encountered in SBCL pid 9337: