Comment 5 for bug 1154385

Revision history for this message
Felix Lange (lp-fjl) wrote :

Here's another failing test case:

    (defun alloc-loop (n)
      (let (buffer)
        (dotimes (i n)
          (setf buffer (make-array (* 100 1024 1024))))
        (aref buffer 0)))

    (time (alloc-loop 100))

The (ALLOC-LOOP 100) invocation fails with SBCL. It works with other CL runtimes including
ECL, which has a conservative collector.

I'm not sure if this has anything to do with it being conservative. My expectation would
be that heap exhaustion causes the GC to run and release unused memory. For some reason,
this does not seem to happen in SBCL.

$ sbcl
This is SBCL 2.0.10, an implementation of ANSI Common Lisp. ...
* (defun alloc-loop (n)
    (let (buffer)
      (dotimes (i n)
        (setf buffer (make-array (* 100 1024 1024))))
      (aref buffer 0)))

ALLOC-LOOP
* (time (alloc-loop 100))
Heap exhausted during allocation: 153190400 bytes available, 838860816 requested.
Gen Boxed Code Raw LgBox LgCode LgRaw Pin Alloc Waste Trig WP GCs Mem-age
 1 130 1 38 25601 0 0 25608 844269840 161520 855007258 25770 1 0.0000
 2 0 0 0 0 0 0 0 0 0 2000000 0 0 0.0000
 3 0 0 0 0 0 0 0 0 0 2000000 0 0 0.0000
 4 0 0 0 0 0 0 0 0 0 2000000 0 0 0.0000
 5 0 0 0 0 0 0 0 0 0 2000000 0 0 0.0000
 6 434 2 184 55 0 10 0 21699536 746544 2000000 685 0 0.0000
           Total bytes allocated = 865969376
           Dynamic-space-size bytes = 1073741824
GC control variables:
   *GC-INHIBIT* = false
   *GC-PENDING* = true
   *STOP-FOR-GC-PENDING* = false