- Replace tabs by spaces (the other codebases I work on all use tabs :)
- After looking at grusage() it seems that we cannot use this to adapt heap_gap
- heap_gap demonstrated to be necessary, at least for now, now set at 50MB
- Minor cleanups
To test:
- Reduce the heap size limit by reducing the soft RLIMIT_DATA of
your current shell. On sh, this can be done using ulimit -d
<kilobytes>. Either reduce it smaller than the ECL default heap
(1GB on 32-bit, 4GB on 64-bit), or specify a larger heap limit to
ECL starting it with the --heap-size <bytes> option (but note that
because of another bug it may be difficult to increase it very
high).
- Start ECL, notice the HEAP-WARNING: messages which should show
that the soft limit was increased to satisfy the heap.
- Run allocations until either ECL freezes or reports a heap error.
the test is successful, it should report, not freeze, obviously :)
Example test to run:
(defparameter *allocations* 16384)
(defparameter *alloc-size* 4096)
(defvar *queue* (make-array 1024
:adjustable t
:fill-pointer 0))
(defun test1 ()
(loop
repeat *allocations*
do
(vector-push-extend (make-array *alloc-size*
:element-type '(unsigned-byte 8)
:adjustable nil
:initial-element #x00
:fill-pointer *alloc-size*)
*queue*
0))) ; Grows automatically +1/2 size on ECL
Run (test1) as often as necessary (and observe heap grow in top(1) etc).
What remains to do before this branch can be merged:
- More testing, and confirmation that 50MB heap_gap is enough for others
- Removal of debug messages
- Perhaps issuing a single message about the size the heap was changed to
and why, but only when in ECL-REPL interactive mode startup
- If possible, determining the value for heap_gap at runtime,
instead of guessing it, but it seems tricky to do portably.