]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Make the freed-block-queue volume metrics 64-bit throughout, to avoid
authorJulian Seward <jseward@acm.org>
Fri, 30 Nov 2007 17:19:36 +0000 (17:19 +0000)
committerJulian Seward <jseward@acm.org>
Fri, 30 Nov 2007 17:19:36 +0000 (17:19 +0000)
any wierdness on very large machines in the future.  Also, double the
default size from 5MB to 10MB, on the basis that programs are now on
average twice as lardy as they were when it was set to 5MB, whenever
that was.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7256

memcheck/docs/mc-manual.xml
memcheck/mc_include.h
memcheck/mc_main.c
memcheck/mc_malloc_wrappers.c

index f8444c76a2685cd7037cdbb9ff0c2c00ea3b2c2d..3ddcc2bbd8e032ed5cf5d452cf33c9f890d5569d 100644 (file)
@@ -122,7 +122,7 @@ the following problems:</para>
 
   <varlistentry id="opt.freelist-vol" xreflabel="--freelist-vol">
     <term>
-      <option><![CDATA[--freelist-vol=<number> [default: 5000000] ]]></option>
+      <option><![CDATA[--freelist-vol=<number> [default: 10000000] ]]></option>
     </term>
     <listitem>
       <para>When the client program releases memory using
@@ -137,7 +137,7 @@ the following problems:</para>
       have been freed.</para>
 
       <para>This flag specifies the maximum total size, in bytes, of the
-      blocks in the queue.  The default value is five million bytes.
+      blocks in the queue.  The default value is ten million bytes.
       Increasing this increases the total amount of memory used by
       <constant>memcheck</constant> but may detect invalid uses of freed
       blocks which would otherwise go undetected.</para>
index fb4cfb7bb03c2ef33b49a9f8b5e242bc7f46963d..c731271f18fc8a035a589e92024050829fa5e1ff 100644 (file)
@@ -255,7 +255,7 @@ extern Bool MC_(record_leak_error)            ( ThreadId tid,
 extern Bool MC_(clo_partial_loads_ok);
 
 /* Max volume of the freed blocks queue. */
-extern SSizeT MC_(clo_freelist_vol);
+extern Long MC_(clo_freelist_vol);
 
 /* Do leak check at exit?  default: NO */
 extern LeakCheckMode MC_(clo_leak_check);
index bc9f2e7af9c87a3e1a65abeebe0800706c6ab722..b24039c9b0d072d6c633650c5ca1f9bf6b6e66bf 100644 (file)
@@ -4367,7 +4367,7 @@ static Bool mc_expensive_sanity_check ( void )
 /*------------------------------------------------------------*/
 
 Bool          MC_(clo_partial_loads_ok)       = False;
-SSizeT        MC_(clo_freelist_vol)           = 5000000;
+Long          MC_(clo_freelist_vol)           = 10*1000*1000LL;
 LeakCheckMode MC_(clo_leak_check)             = LC_Summary;
 VgRes         MC_(clo_leak_resolution)        = Vg_LowRes;
 Bool          MC_(clo_show_reachable)         = False;
@@ -4382,7 +4382,8 @@ static Bool mc_process_cmd_line_options(Char* arg)
 
    else VG_BOOL_CLO(arg, "--undef-value-errors",    MC_(clo_undef_value_errors))
    
-   else VG_BNUM_CLO(arg, "--freelist-vol",  MC_(clo_freelist_vol), 0, 1000000000)
+   else VG_BNUM_CLO(arg, "--freelist-vol",  MC_(clo_freelist_vol), 
+                                            0, 10*1000*1000*1000LL)
    
    else if (VG_CLO_STREQ(arg, "--leak-check=no"))
       MC_(clo_leak_check) = LC_Off;
@@ -4442,7 +4443,7 @@ static void mc_print_usage(void)
 "    --show-reachable=no|yes          show reachable blocks in leak check? [no]\n"
 "    --undef-value-errors=no|yes      check for undefined value errors [yes]\n"
 "    --partial-loads-ok=no|yes        too hard to explain here; see manual [no]\n"
-"    --freelist-vol=<number>          volume of freed blocks queue [5000000]\n"
+"    --freelist-vol=<number>          volume of freed blocks queue [10000000]\n"
 "    --workaround-gcc296-bugs=no|yes  self explanatory [no]\n"
 "    --ignore-ranges=0xPP-0xQQ[,0xRR-0xSS]   assume given addresses are OK\n"
    );
index aa9c68815f4c781ae04454af01f75fcd953a0190..4fd9aec93a595c66d368fa48791129150a5877e1 100644 (file)
@@ -71,22 +71,27 @@ VgHashTable MC_(mempool_list) = NULL;
 /* Records blocks after freeing. */
 static MC_Chunk* freed_list_start  = NULL;
 static MC_Chunk* freed_list_end    = NULL;
-static SSizeT    freed_list_volume = 0;
+static Long      freed_list_volume = 0;
 
 /* Put a shadow chunk on the freed blocks queue, possibly freeing up
    some of the oldest blocks in the queue at the same time. */
 static void add_to_freed_queue ( MC_Chunk* mc )
 {
+   const Bool show = False;
+
    /* Put it at the end of the freed list */
    if (freed_list_end == NULL) {
       tl_assert(freed_list_start == NULL);
       freed_list_end    = freed_list_start = mc;
-      freed_list_volume = mc->szB;
+      freed_list_volume = (Long)mc->szB;
    } else {
       tl_assert(freed_list_end->next == NULL);
       freed_list_end->next = mc;
       freed_list_end       = mc;
-      freed_list_volume += mc->szB;
+      freed_list_volume += (Long)mc->szB;
+      if (show)
+         VG_(printf)("mc_freelist: acquire: volume now %lld\n", 
+                     freed_list_volume);
    }
    mc->next = NULL;
 
@@ -100,8 +105,10 @@ static void add_to_freed_queue ( MC_Chunk* mc )
       tl_assert(freed_list_end != NULL);
 
       mc1 = freed_list_start;
-      freed_list_volume -= mc1->szB;
-      /* VG_(printf)("volume now %d\n", freed_list_volume); */
+      freed_list_volume -= (Long)mc1->szB;
+      if (show)
+         VG_(printf)("mc_freelist: discard: volume now %lld\n", 
+                     freed_list_volume);
       tl_assert(freed_list_volume >= 0);
 
       if (freed_list_start == freed_list_end) {
@@ -174,7 +181,6 @@ static Bool complain_about_silly_args2(SizeT n, SizeT sizeB)
 }
 
 /* Allocate memory and note change in memory available */
-__inline__
 void* MC_(new_block) ( ThreadId tid,
                         Addr p, SizeT szB, SizeT alignB, UInt rzB,
                         Bool is_zeroed, MC_AllocKind kind, VgHashTable table)
@@ -278,7 +284,6 @@ void die_and_free_mem ( ThreadId tid, MC_Chunk* mc, SizeT rzB )
    }
 }
 
-__inline__
 void MC_(handle_free) ( ThreadId tid, Addr p, UInt rzB, MC_AllocKind kind )
 {
    MC_Chunk* mc;