Author: sewardj
Date: 2007-11-30 17:19:36 +0000 (Fri, 30 Nov 2007)
New Revision: 7256

Log:
Make the freed-block-queue volume metrics 64-bit throughout, to avoid
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.

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


Modified: trunk/memcheck/docs/mc-manual.xml
===================================================================
--- trunk/memcheck/docs/mc-manual.xml   2007-11-30 15:28:13 UTC (rev 7255)
+++ trunk/memcheck/docs/mc-manual.xml   2007-11-30 17:19:36 UTC (rev 7256)
@@ -122,7 +122,7 @@
 
   <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 @@
       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>

Modified: trunk/memcheck/mc_include.h
===================================================================
--- trunk/memcheck/mc_include.h 2007-11-30 15:28:13 UTC (rev 7255)
+++ trunk/memcheck/mc_include.h 2007-11-30 17:19:36 UTC (rev 7256)
@@ -255,7 +255,7 @@
 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);

Modified: trunk/memcheck/mc_main.c
===================================================================
--- trunk/memcheck/mc_main.c    2007-11-30 15:28:13 UTC (rev 7255)
+++ trunk/memcheck/mc_main.c    2007-11-30 17:19:36 UTC (rev 7256)
@@ -4367,7 +4367,7 @@
 /*------------------------------------------------------------*/
 
 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 @@
 
    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 @@
 "    --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"
    );

Modified: trunk/memcheck/mc_malloc_wrappers.c
===================================================================
--- trunk/memcheck/mc_malloc_wrappers.c 2007-11-30 15:28:13 UTC (rev 7255)
+++ trunk/memcheck/mc_malloc_wrappers.c 2007-11-30 17:19:36 UTC (rev 7256)
@@ -71,22 +71,27 @@
 /* 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 @@
       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 @@
 }
 
 /* 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 @@
    }
 }
 
-__inline__
 void MC_(handle_free) ( ThreadId tid, Addr p, UInt rzB, MC_AllocKind kind )
 {
    MC_Chunk* mc;


-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Valgrind-developers mailing list
Valgrind-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-developers

Reply via email to