]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Get rid of the --sloppy-malloc= flag and the functionality it
authorJulian Seward <jseward@acm.org>
Tue, 5 Apr 2005 20:59:55 +0000 (20:59 +0000)
committerJulian Seward <jseward@acm.org>
Tue, 5 Apr 2005 20:59:55 +0000 (20:59 +0000)
controlled (rounding user malloc requests up to a multiple of 4).
Subsequent changes to memcheck made it more or less pointless, it is a
time waster in the malloc/free path, and nobody ever used it AFAIK.

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

coregrind/core.h
coregrind/vg_malloc2.c
coregrind/vg_replace_malloc.c
coregrind/vg_scheduler.c
docs/xml/manual-core.xml
include/tool.h.base

index 7b03d96a2f3d0729a21aaeaea75261d504cf9729..0d4da658dcc01b778c9954703dbeb852efe7cca0 100644 (file)
@@ -385,9 +385,6 @@ typedef Int ArenaId;
 // greater than 8.
 #define VG_MIN_MALLOC_SZB        8
 
-// Round-up size for --sloppy-malloc=yes.
-#define VG_SLOPPY_MALLOC_SZB     4
-
 extern void* VG_(arena_malloc)  ( ArenaId arena, SizeT nbytes );
 extern void  VG_(arena_free)    ( ArenaId arena, void* ptr );
 extern void* VG_(arena_calloc)  ( ArenaId arena, 
@@ -500,7 +497,6 @@ struct vg_mallocfunc_info {
 
    SizeT (*arena_payload_szB)      (ArenaId aid, void* payload);
 
-   Bool        clo_sloppy_malloc;
    Bool        clo_trace_malloc;
 };
 
index ae9463b8aef0bc85ad5aefdc8838366f0a9630b2..1af123de8447e61f37bb48fb5c169c011666e707 100644 (file)
@@ -518,13 +518,9 @@ Superblock* findSb ( Arena* a, Block* b )
 /*--- Command line options                                 ---*/
 /*------------------------------------------------------------*/
 
-/* Round malloc sizes up to a multiple of VG_SLOPPY_MALLOC_SZB bytes?
-     default: NO
-   Nb: the allocator always rounds blocks up to a multiple of
-   VG_MIN_MALLOC_SZB.  VG_(clo_sloppy_malloc) is relevant eg. for
-   Memcheck, which will be byte-precise with addressability maps on its
-   malloc allocations unless --sloppy-malloc=yes.  */
-Bool VG_(clo_sloppy_malloc) = False;
+/* Nb: the allocator always rounds blocks up to a multiple of
+   VG_MIN_MALLOC_SZB.
+*/
 
 /* DEBUG: print malloc details?  default: NO */
 Bool VG_(clo_trace_malloc)  = False;
@@ -550,7 +546,6 @@ Bool VG_(replacement_malloc_process_cmd_line_option)(Char* arg)
       }
    }
 
-   else VG_BOOL_CLO(arg, "--sloppy-malloc", VG_(clo_sloppy_malloc))
    else VG_BOOL_CLO(arg, "--trace-malloc",  VG_(clo_trace_malloc))
    else 
       return False;
@@ -561,9 +556,8 @@ Bool VG_(replacement_malloc_process_cmd_line_option)(Char* arg)
 void VG_(replacement_malloc_print_usage)(void)
 {
    VG_(printf)(
-"    --sloppy-malloc=no|yes    round malloc sizes to multiple of %d? [no]\n"
 "    --alignment=<number>      set minimum alignment of allocations [%d]\n",
-   VG_SLOPPY_MALLOC_SZB, VG_MIN_MALLOC_SZB
+   VG_MIN_MALLOC_SZB
    );
 }
 
index 0fd0cf3a43fbdc228719c12108bb1386ce144737..6d5a69807c98c0de9440ada966d00c7d5d17c8b5 100644 (file)
@@ -153,12 +153,6 @@ internal_printf(char *format, ...)
    if (info.clo_trace_malloc)          \
       internal_printf(format, ## args )
 
-#define MAYBE_SLOPPIFY(n)           \
-   if (info.clo_sloppy_malloc) {    \
-      n = (n+(VG_SLOPPY_MALLOC_SZB-1)) & ~(VG_SLOPPY_MALLOC_SZB-1); \
-   }
-
-
 /* Below are new versions of malloc, __builtin_new, free, 
    __builtin_delete, calloc, realloc, memalign, and friends.
 
@@ -180,7 +174,6 @@ internal_printf(char *format, ...)
       void* v; \
       \
       MALLOC_TRACE(#fnname "(%llu)", (ULong)n ); \
-      MAYBE_SLOPPIFY(n); \
       if (!init_done) init(); \
       \
       v = (void*)VALGRIND_NON_SIMD_CALL1( info.tl_##vg_replacement, n ); \
@@ -201,7 +194,6 @@ internal_printf(char *format, ...)
       void* v; \
       \
       MALLOC_TRACE(#fnname "(%llu)", (ULong)n ); \
-      MAYBE_SLOPPIFY(n); \
       if (!init_done) init(); \
       \
       v = (void*)VALGRIND_NON_SIMD_CALL1( info.tl_##vg_replacement, n ); \
@@ -305,7 +297,6 @@ FREE(m_libc_dot_so_dot_6,      _ZdaPvRKSt9nothrow_t, __builtin_vec_delete );
       void* v; \
       \
       MALLOC_TRACE("calloc(%llu,%llu)", (ULong)nmemb, (ULong)size ); \
-      MAYBE_SLOPPIFY(size); \
       \
       if (!init_done) init(); \
       v = (void*)VALGRIND_NON_SIMD_CALL2( info.tl_calloc, nmemb, size ); \
@@ -324,7 +315,6 @@ CALLOC(m_libc_dot_so_dot_6, calloc);
       void* v; \
       \
       MALLOC_TRACE("realloc(%p,%llu)", ptrV, (ULong)new_size ); \
-      MAYBE_SLOPPIFY(new_size); \
       \
       if (ptrV == NULL) \
          /* We need to call a malloc-like function; so let's use \
@@ -354,7 +344,6 @@ REALLOC(m_libc_dot_so_dot_6, realloc);
       \
       MALLOC_TRACE("memalign(al %llu, size %llu)", \
                    (ULong)alignment, (ULong)n ); \
-      MAYBE_SLOPPIFY(n); \
       \
       /* Round up to minimum alignment if necessary. */ \
       if (alignment < VG_MIN_MALLOC_SZB) \
index 0fe240cddc8981e5cb52680157d2adada55a683d..63ba06aa65d05ec4416e7e4d515a75b5abe4076d 100644 (file)
@@ -1026,8 +1026,6 @@ void do_client_request ( ThreadId tid )
         info->tl___builtin_vec_delete = VG_(tdict).malloc___builtin_vec_delete;
 
         info->arena_payload_szB       = VG_(arena_payload_szB);
-        
-        info->clo_sloppy_malloc       = VG_(clo_sloppy_malloc);
         info->clo_trace_malloc        = VG_(clo_trace_malloc);
 
          SET_CLREQ_RETVAL( tid, 0 );     /* return value is meaningless */
index 3a0e79cbf1adf9f12d1a0e680a0fa86905648174..bc524b20af418e48ac7d513ad07ae5ec7c26cb11 100644 (file)
@@ -907,29 +907,6 @@ Addrcheck), the following options apply.</para>
     and 4096 inclusive, and must be a power of two.</para>
    </listitem>
 
-   <listitem>
-    <para><computeroutput>--sloppy-malloc=no</computeroutput>
-     [default]</para>
-    <para><computeroutput>--sloppy-malloc=yes</computeroutput></para>
-    <para>When enabled, all requests for malloc/calloc are
-    rounded up to a whole number of machine words -- in other
-    words, made divisible by 4.  For example, a request for 17
-    bytes of space would result in a 20-byte area being made
-    available.  This works around bugs in sloppy libraries which
-    assume that they can safely rely on malloc/calloc requests
-    being rounded up in this fashion.  Without the workaround,
-    these libraries tend to generate large numbers of errors when
-    they access the ends of these areas.</para>
-
-    <para>Valgrind snapshots dated 17 Feb 2002 and later are
-    cleverer about this problem, and you should no longer need to
-    use this flag.  To put it bluntly, if you do need to use this
-    flag, your program violates the ANSI C semantics defined for
-    <computeroutput>malloc</computeroutput> and
-    <computeroutput>free</computeroutput>, even if it appears to
-    work correctly, and you should fix it, at least if you hope
-    for maximum portability.</para>
-   </listitem>
   </itemizedlist>
 
  </sect2>
index 58fdcf7cadca866c7ba4ccfca2e4f2732d5b99bb..69d187603e65accfb07ed6df833b9ebb17158bb1 100644 (file)
@@ -920,8 +920,6 @@ extern Bool VG_(addr_is_in_block)( Addr a, Addr start, SizeT size );
    The tool should call the functions in the appropriate places to give
    control over these aspects of Valgrind's version of malloc(). */
 
-/* Round malloc sizes upwards to integral number of words? default: NO */
-extern Bool VG_(clo_sloppy_malloc);
 /* DEBUG: print malloc details?  default: NO */
 extern Bool VG_(clo_trace_malloc);
 /* Minimum alignment in functions that don't specify alignment explicitly.