From a023b5598196cd84f98877f94e804c788aec7982 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Sun, 3 Aug 2008 08:52:03 +0000 Subject: [PATCH] (check_memory_limits) [HAVE_GETRLIMIT]: Fix calculation of data_size. Use correct type for five_percent. --- src/ChangeLog | 5 +++++ src/vm-limit.c | 9 ++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 015ecf02094..4f7354dd6aa 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2008-08-03 Andreas Schwab + + * vm-limit.c (check_memory_limits) [HAVE_GETRLIMIT]: Fix + calculation of data_size. Use correct type for five_percent. + 2008-08-02 Chong Yidong * vm-limit.c (check_memory_limits): Don't use getrlimit on cygwin. diff --git a/src/vm-limit.c b/src/vm-limit.c index 7628d29b607..348fccbb827 100644 --- a/src/vm-limit.c +++ b/src/vm-limit.c @@ -148,7 +148,11 @@ check_memory_limits () extern POINTER (*__morecore) (); register POINTER cp; +#if defined (HAVE_GETRLIMIT) && ! defined (CYGWIN) + rlim_t five_percent; +#else unsigned long five_percent; +#endif unsigned long data_size; enum warnlevel new_warnlevel; @@ -163,7 +167,6 @@ check_memory_limits () || rlimit.rlim_cur > rlimit.rlim_max) return; five_percent = rlimit.rlim_max / 20; - data_size = rlimit.rlim_cur; #else /* not HAVE_GETRLIMIT */ @@ -171,6 +174,8 @@ check_memory_limits () get_lim_data (); five_percent = lim_data / 20; +#endif /* not HAVE_GETRLIMIT */ + /* Find current end of memory and issue warning if getting near max */ #ifdef REL_ALLOC if (real_morecore) @@ -180,8 +185,6 @@ check_memory_limits () cp = (char *) (*__morecore) (0); data_size = (char *) cp - (char *) data_space_start; -#endif /* not HAVE_GETRLIMIT */ - if (!warn_function) return; -- 2.39.2