Jeroen Demeyer on Thu, 14 Jan 2016 10:31:11 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PATCH] Guard stack size warnings with DEBUGMEM


I don't like random warnings about the stack size to appear, what do you think of this patch?

You could even make debugmem=1 the default if you want.

Cheers,
Jeroen.
commit 1d60a0f2c5a22e167fc019afbd81d65dc3906179
Author: Jeroen Demeyer <jdemeyer@cage.ugent.be>
Date:   Thu Jan 14 10:13:39 2016 +0100

    Use DEBUGMEM for stack size warnings

diff --git a/src/language/init.c b/src/language/init.c
index a673cbc..4619383 100644
--- a/src/language/init.c
+++ b/src/language/init.c
@@ -736,7 +736,8 @@ paristack_newrsize(ulong newsize)
     pari_mainstack_resize(pari_mainstack, newsize, vsize);
   evalstate_reset();
   s = pari_mainstack->rsize;
-  pari_warn(warner,"new stack size = %lu (%.3f Mbytes)", s, s/1048576.);
+  if (DEBUGMEM > 0)
+    pari_warn(warner,"new stack size = %lu (%.3f Mbytes)", s, s/1048576.);
   pari_init_errcatch();
   cb_pari_err_recover(-1);
 }
@@ -750,7 +751,8 @@ paristack_resize(ulong newsize)
   newsize = maxuu(minuu(newsize, vsize), pari_mainstack->size);
   pari_mainstack->size = newsize;
   pari_mainstack->bot = pari_mainstack->top - pari_mainstack->size;
-  pari_warn(warner,"increasing stack size to %lu",newsize);
+  if (DEBUGMEM > 0)
+    pari_warn(warner,"increasing stack size to %lu",newsize);
 }
 
 void