Mercurial > emacs
comparison src/alloc.c @ 47185:2ff45b08a155
(display_malloc_warning): Use display-warning.
(malloc_warning_1): Function deleted.
[ALLOC_DEBUG]: #undef INLINE.
| author | Richard M. Stallman <rms@gnu.org> |
|---|---|
| date | Sun, 01 Sep 2002 13:37:41 +0000 |
| parents | b80760a75295 |
| children | 1afd007f814f |
comparison
equal
deleted
inserted
replaced
| 47184:04a4d5eda995 | 47185:2ff45b08a155 |
|---|---|
| 19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 20 Boston, MA 02111-1307, USA. */ | 20 Boston, MA 02111-1307, USA. */ |
| 21 | 21 |
| 22 #include <config.h> | 22 #include <config.h> |
| 23 #include <stdio.h> | 23 #include <stdio.h> |
| 24 | |
| 25 #ifdef ALLOC_DEBUG | |
| 26 #undef INLINE | |
| 27 #endif | |
| 24 | 28 |
| 25 /* Note that this declares bzero on OSF/1. How dumb. */ | 29 /* Note that this declares bzero on OSF/1. How dumb. */ |
| 26 | 30 |
| 27 #include <signal.h> | 31 #include <signal.h> |
| 28 | 32 |
| 420 | 424 |
| 421 /************************************************************************ | 425 /************************************************************************ |
| 422 Malloc | 426 Malloc |
| 423 ************************************************************************/ | 427 ************************************************************************/ |
| 424 | 428 |
| 425 /* Write STR to Vstandard_output plus some advice on how to free some | 429 /* Function malloc calls this if it finds we are near exhausting storage. */ |
| 426 memory. Called when memory gets low. */ | |
| 427 | |
| 428 Lisp_Object | |
| 429 malloc_warning_1 (str) | |
| 430 Lisp_Object str; | |
| 431 { | |
| 432 Fprinc (str, Vstandard_output); | |
| 433 write_string ("\nKilling some buffers may delay running out of memory.\n", -1); | |
| 434 write_string ("However, certainly by the time you receive the 95% warning,\n", -1); | |
| 435 write_string ("you should clean up, kill this Emacs, and start a new one.", -1); | |
| 436 return Qnil; | |
| 437 } | |
| 438 | |
| 439 | |
| 440 /* Function malloc calls this if it finds we are near exhausting | |
| 441 storage. */ | |
| 442 | 430 |
| 443 void | 431 void |
| 444 malloc_warning (str) | 432 malloc_warning (str) |
| 445 char *str; | 433 char *str; |
| 446 { | 434 { |
| 447 pending_malloc_warning = str; | 435 pending_malloc_warning = str; |
| 448 } | 436 } |
| 449 | 437 |
| 450 | 438 |
| 451 /* Display a malloc warning in buffer *Danger*. */ | 439 /* Display an already-pending malloc warning. */ |
| 452 | 440 |
| 453 void | 441 void |
| 454 display_malloc_warning () | 442 display_malloc_warning () |
| 455 { | 443 { |
| 456 register Lisp_Object val; | 444 call3 (intern ("display-warning"), |
| 457 | 445 intern ("alloc"), |
| 458 val = build_string (pending_malloc_warning); | 446 build_string (pending_malloc_warning), |
| 447 intern ("emergency")); | |
| 459 pending_malloc_warning = 0; | 448 pending_malloc_warning = 0; |
| 460 internal_with_output_to_temp_buffer (" *Danger*", malloc_warning_1, val); | |
| 461 } | 449 } |
| 462 | 450 |
| 463 | 451 |
| 464 #ifdef DOUG_LEA_MALLOC | 452 #ifdef DOUG_LEA_MALLOC |
| 465 # define BYTES_USED (mallinfo ().arena) | 453 # define BYTES_USED (mallinfo ().arena) |
