X-Git-Url: http://git.chise.org/gitweb/?p=chise%2Fxemacs-chise.git.1;a=blobdiff_plain;f=src%2Fvm-limit.c;h=80d8c6385e186d41f2de268b6d905ec4c5b83d98;hp=b6c7ddad7f00aec16436d1abb92cc9fb3c5cd6bb;hb=566b3d194e2d5c783808ac39437bd7e1a28b1c5c;hpb=3890a2e3064a7f562107c58e59d928284ec04741 diff --git a/src/vm-limit.c b/src/vm-limit.c index b6c7dda..80d8c63 100644 --- a/src/vm-limit.c +++ b/src/vm-limit.c @@ -57,6 +57,7 @@ check_memory_limits (void) POINTER cp; unsigned long five_percent; unsigned long data_size; + void (*save_warn_fun) (const char *); if (lim_data == 0) get_lim_data (); @@ -67,36 +68,43 @@ check_memory_limits (void) data_size = (char *) cp - (char *) data_space_start; if (warn_function) - switch (warnlevel) - { - case 0: - if (data_size > five_percent * 15) - { - warnlevel++; - (*warn_function) ("Warning: past 75% of memory limit"); - } - break; - - case 1: - if (data_size > five_percent * 17) - { - warnlevel++; - (*warn_function) ("Warning: past 85% of memory limit"); - } - break; - - case 2: - if (data_size > five_percent * 19) - { - warnlevel++; - (*warn_function) ("Warning: past 95% of memory limit"); - } - break; - - default: - (*warn_function) ("Warning: past acceptable memory limits"); - break; - } + { + /* temporarily reset the warn_function to 0 or we will get infinite + looping. */ + save_warn_fun = warn_function; + warn_function = 0; + switch (warnlevel) + { + case 0: + if (data_size > five_percent * 15) + { + warnlevel++; + (*save_warn_fun) ("Warning: past 75% of memory limit"); + } + break; + + case 1: + if (data_size > five_percent * 17) + { + warnlevel++; + (*save_warn_fun) ("Warning: past 85% of memory limit"); + } + break; + + case 2: + if (data_size > five_percent * 19) + { + warnlevel++; + (*save_warn_fun) ("Warning: past 95% of memory limit"); + } + break; + + default: + (*save_warn_fun) ("Warning: past acceptable memory limits"); + break; + } + warn_function = save_warn_fun; + } /* If we go down below 70% full, issue another 75% warning when we go up again. */ @@ -112,7 +120,18 @@ check_memory_limits (void) warnlevel = 2; if (EXCEEDS_LISP_PTR (cp)) - (*warn_function) ("Warning: memory in use exceeds lisp pointer size"); + { + if (warn_function) + { + /* temporarily reset the warn_function to 0 or we will get infinite + looping. */ + save_warn_fun = warn_function; + warn_function = 0; + (*save_warn_fun) + ("Warning: memory in use exceeds lisp pointer size"); + warn_function = save_warn_fun; + } + } } /* Cause reinitialization based on job parameters;