* test-suite/standalone/test-out-of-memory: Prevent the test harness
from being inlined. If the test harness is inlined, it might cause
the optimizer to omit the allocations being tested!
On Cygwin, setrlimits cannot be used to set total memory availabe
for a process.
* test-suite/standalone/test-out-of-memory: skip for cygwin
* test-suite/standalone/test-stack-overflow: skip for cygwin
On Darwin, setrlimit is ignored, and these tests do not terminate. There
doesn't seem to be another way to limit the memory allocated by a
process.
* test-suite/standalone/test-stack-overflow: Skip this test on Darwin.
* test-suite/standalone/test-out-of-memory: Skip this test on Darwin.
* test-suite/standalone/test-out-of-memory:
* test-suite/standalone/test-stack-overflow: Compile these files before
running them. That way, recursion can check the stack-overflow
mechanism instead of the memory allocation mechanism. We compile
beforehand as a prepass so as not to impose an rlimit on a Guile that
previously ran auto-compilation.
* test-suite/standalone/test-out-of-memory (*limit*): Reduce limit to 50 MB.
Adapt vector test to avoid exceeding maximum vector size on 32-bit
systems.
* libguile/gc.c (scm_oom_fn, scm_init_gc): Install an out-of-memory
handler that raises an unwind-only out-of-memory exception.
(scm_gc_warn_proc, scm_init_gc): Install a warning proc that tries to
print to the current warning port, if the current warning port is a
file port.
(scm_gc_after_nonlocal_exit): New interface. Should be called after a
nonlocal return to potentially collect memory; otherwise allocations
could try to expand again when they should collect.
* libguile/continuations.c (scm_i_make_continuation):
* libguile/eval.c (eval):
* libguile/throw.c (catch):
* libguile/vm.c (scm_call_n): Call scm_gc_after_nonlocal_exit after
nonlocal returns.
* libguile/throw.c (abort_to_prompt, throw_without_pre_unwind): Rework
to avoid allocating memory.
(scm_report_out_of_memory): New interface.
(scm_init_throw): Pre-allocate the arguments for stack-overflow and
out-of-memory errors.
* module/ice-9/boot-9.scm: Add an out-of-memory exception printer.
* module/system/repl/error-handling.scm (call-with-error-handling): Add
out-of-memory to the report-keys set.
* libguile/gc-malloc.c (scm_realloc): Call scm_report_out_of_memory if
realloc fails.
* libguile/error.h:
* libguile/error.c:
* libguile/deprecated.h:
* libguile/deprecated.c (scm_memory_error): Deprecate.
* test-suite/standalone/Makefile.am:
* test-suite/standalone/test-out-of-memory: New test case.