changeset 635:5338832d2cf6

[project @ 1994-08-23 17:57:20 by jwe]
author jwe
date Tue, 23 Aug 1994 17:57:20 +0000
parents e04527366917
children fae2bd91c027
files src/sighandlers.cc
diffstat 1 files changed, 17 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/sighandlers.cc	Mon Aug 22 23:44:52 1994 +0000
+++ b/src/sighandlers.cc	Tue Aug 23 17:57:20 1994 +0000
@@ -25,6 +25,7 @@
 #include "config.h"
 #endif
 
+#include <new.h>
 #include <signal.h>
 
 #include "sighandlers.h"
@@ -46,9 +47,16 @@
   clean_up_and_exit (sig_number);
 }
 
-/*
- * Some of these may eventually perform different actions...
- */
+// I know, not really a signal handler.
+
+static void
+octave_new_handler (void)
+{
+  error ("new: virtual memory exhausted -- stopping myself");
+  clean_up_and_exit (1);
+}
+
+// Some of these may eventually perform different actions...
 
 static RETSIGTYPE
 sigabrt_handler (int i)
@@ -92,9 +100,8 @@
   my_friendly_exit ("SIGILL", i);
 }
 
-/*
- * Handle SIGINT by restarting the parser (see octave.cc).
- */
+// Handle SIGINT by restarting the parser (see octave.cc).
+
 static RETSIGTYPE
 sigint_handler (int i)
 {
@@ -212,12 +219,13 @@
   my_friendly_exit ("SIGXFSZ", i);
 }
 
-/*
- * Install all the handlers for the signals we might care about.
- */
+// Install all the handlers for the signals we might care about.
+
 void
 install_signal_handlers (void)
 {
+  set_new_handler (octave_new_handler);
+
 #ifdef SIGABRT
   signal (SIGABRT, sigabrt_handler);
 #endif