22 |
#include <config.h> |
#include <config.h> |
23 |
#include <stdio.h> |
#include <stdio.h> |
24 |
|
|
25 |
|
#ifdef ALLOC_DEBUG |
26 |
|
#undef INLINE |
27 |
|
#endif |
28 |
|
|
29 |
/* Note that this declares bzero on OSF/1. How dumb. */ |
/* Note that this declares bzero on OSF/1. How dumb. */ |
30 |
|
|
31 |
#include <signal.h> |
#include <signal.h> |
426 |
Malloc |
Malloc |
427 |
************************************************************************/ |
************************************************************************/ |
428 |
|
|
429 |
/* Write STR to Vstandard_output plus some advice on how to free some |
/* Function malloc calls this if it finds we are near exhausting storage. */ |
|
memory. Called when memory gets low. */ |
|
|
|
|
|
Lisp_Object |
|
|
malloc_warning_1 (str) |
|
|
Lisp_Object str; |
|
|
{ |
|
|
Fprinc (str, Vstandard_output); |
|
|
write_string ("\nKilling some buffers may delay running out of memory.\n", -1); |
|
|
write_string ("However, certainly by the time you receive the 95% warning,\n", -1); |
|
|
write_string ("you should clean up, kill this Emacs, and start a new one.", -1); |
|
|
return Qnil; |
|
|
} |
|
|
|
|
|
|
|
|
/* Function malloc calls this if it finds we are near exhausting |
|
|
storage. */ |
|
430 |
|
|
431 |
void |
void |
432 |
malloc_warning (str) |
malloc_warning (str) |
436 |
} |
} |
437 |
|
|
438 |
|
|
439 |
/* Display a malloc warning in buffer *Danger*. */ |
/* Display an already-pending malloc warning. */ |
440 |
|
|
441 |
void |
void |
442 |
display_malloc_warning () |
display_malloc_warning () |
443 |
{ |
{ |
444 |
register Lisp_Object val; |
call3 (intern ("display-warning"), |
445 |
|
intern ("alloc"), |
446 |
val = build_string (pending_malloc_warning); |
build_string (pending_malloc_warning), |
447 |
|
intern ("emergency")); |
448 |
pending_malloc_warning = 0; |
pending_malloc_warning = 0; |
|
internal_with_output_to_temp_buffer (" *Danger*", malloc_warning_1, val); |
|
449 |
} |
} |
450 |
|
|
451 |
|
|