From b79bc438aadeda878eaa2a26c72129edffba4be7 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 18 Aug 2017 06:38:30 -0700 Subject: Revising out-of-memory handling. We don't want to be aborting on OOM, but throwing an exception. * lib.c (alloc_error_s): New symbol variable. (oom_realloc): Global variable removed. (oom): New static function. (chk_malloc, chk_malloc_gc_more, chk_calloc, chk_realloc): Call oom instead of removed oom_realloc handler. (env): Throw alloc-error rather than error by calling oom. (obj_init): Initialize alloc_error_s. (init): Drop function pointer argument; do not initialize removed oom_realloc. * lib.h (alloc_error_s): Declared. (oom_realloc): Declaration removed. (init): Declaration updated. * txr.1: Type tree diagram includes alloc-error. --- unwind.c | 1 + 1 file changed, 1 insertion(+) (limited to 'unwind.c') diff --git a/unwind.c b/unwind.c index e4cc28f3..80baf6ee 100644 --- a/unwind.c +++ b/unwind.c @@ -1038,6 +1038,7 @@ void uw_init(void) uw_register_subtype(file_error_s, error_s); uw_register_subtype(process_error_s, error_s); uw_register_subtype(system_error_s, error_s); + uw_register_subtype(alloc_error_s, error_s); uw_register_subtype(timeout_error_s, error_s); uw_register_subtype(assert_s, error_s); uw_register_subtype(syntax_error_s, error_s); -- cgit v1.2.3