]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Oops. Fix longstanding bug which will have caused an unnecessary 4M
authorJulian Seward <jseward@acm.org>
Sat, 5 May 2007 12:26:23 +0000 (12:26 +0000)
committerJulian Seward <jseward@acm.org>
Sat, 5 May 2007 12:26:23 +0000 (12:26 +0000)
of bss space to be allocated.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1763

VEX/priv/main/vex_util.c

index 3c6adc96b789165793af9715a77c32ac5c2654fa..6caca169e53d02d166db2d0e24aac8a1f094607c 100644 (file)
@@ -71,12 +71,12 @@ static HChar* temporary_last  = &temporary[N_TEMPORARY_BYTES-1];
 
 static ULong  temporary_bytes_allocd_TOT = 0;
 
-#define N_PERMANENT_BYTES 1000
+#define N_PERMANENT_BYTES 10000
 
-static HChar  permanent[N_TEMPORARY_BYTES] __attribute__((aligned(8)));
+static HChar  permanent[N_PERMANENT_BYTES] __attribute__((aligned(8)));
 static HChar* permanent_first = &permanent[0];
 static HChar* permanent_curr  = &permanent[0];
-static HChar* permanent_last  = &permanent[N_TEMPORARY_BYTES-1];
+static HChar* permanent_last  = &permanent[N_PERMANENT_BYTES-1];
 
 static VexAllocMode mode = VexAllocModeTEMP;
 
@@ -85,7 +85,7 @@ void vexAllocSanityCheck ( void )
    vassert(temporary_first == &temporary[0]);
    vassert(temporary_last  == &temporary[N_TEMPORARY_BYTES-1]);
    vassert(permanent_first == &permanent[0]);
-   vassert(permanent_last  == &permanent[N_TEMPORARY_BYTES-1]);
+   vassert(permanent_last  == &permanent[N_PERMANENT_BYTES-1]);
    vassert(temporary_first <= temporary_curr);
    vassert(temporary_curr  <= temporary_last);
    vassert(permanent_first <= permanent_curr);
@@ -178,7 +178,7 @@ void private_LibVEX_alloc_OOM(void)
               private_LibVEX_alloc_first,
               private_LibVEX_alloc_curr,
               private_LibVEX_alloc_last,
-              (Long)(private_LibVEX_alloc_last - private_LibVEX_alloc_first));
+              (Long)(private_LibVEX_alloc_last + 1 - private_LibVEX_alloc_first));
    vpanic("VEX temporary storage exhausted.\n"
           "Increase N_{TEMPORARY,PERMANENT}_BYTES and recompile.");
 }
@@ -202,6 +202,8 @@ void LibVEX_ShowAllocStats ( void )
 {
    vex_printf("vex storage: T total %lld bytes allocated\n",
               (Long)temporary_bytes_allocd_TOT );
+   vex_printf("vex storage: P total %lld bytes allocated\n",
+              (Long)(permanent_curr - permanent_first) );
 }