diff options
author | Andy Wingo <wingo@pobox.com> | 2014-03-22 15:49:31 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2014-03-22 15:49:31 +0100 |
commit | c2247b782a9234bb9aedee5204c30daf1d01a510 (patch) | |
tree | b5d04cd1bc9d39161d098df22eed7b731d9a588f /libguile/deprecated.h | |
parent | 0463a927c4ba4e941a3e7d100c629adf7e64b7c2 (diff) | |
download | guile-c2247b782a9234bb9aedee5204c30daf1d01a510.tar.gz |
Out-of-memory situations raise exceptions instead of aborting
* 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.
Diffstat (limited to 'libguile/deprecated.h')
-rw-r--r-- | libguile/deprecated.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/libguile/deprecated.h b/libguile/deprecated.h index d02fc7976..ae1fb04c4 100644 --- a/libguile/deprecated.h +++ b/libguile/deprecated.h @@ -5,7 +5,7 @@ #ifndef SCM_DEPRECATED_H #define SCM_DEPRECATED_H -/* Copyright (C) 2003,2004, 2005, 2006, 2007, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc. +/* Copyright (C) 2003,2004, 2005, 2006, 2007, 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -140,9 +140,14 @@ typedef scm_i_t_array scm_i_t_array__GONE__REPLACE_WITH__scm_t_array; /* Deprecated 26-05-2011, as the GC_STUBBORN API doesn't do anything any more. */ -SCM_API SCM scm_immutable_cell (scm_t_bits car, scm_t_bits cdr); -SCM_API SCM scm_immutable_double_cell (scm_t_bits car, scm_t_bits cbr, - scm_t_bits ccr, scm_t_bits cdr); +SCM_DEPRECATED SCM scm_immutable_cell (scm_t_bits car, scm_t_bits cdr); +SCM_DEPRECATED SCM scm_immutable_double_cell (scm_t_bits car, scm_t_bits cbr, + scm_t_bits ccr, scm_t_bits cdr); + + + +SCM_DEPRECATED SCM scm_memory_alloc_key; +SCM_DEPRECATED void scm_memory_error (const char *subr) SCM_NORETURN; |