From: Philippe Waroquiers Date: Wed, 11 Jan 2017 22:13:52 +0000 (+0000) Subject: Do not capture the free stacktrace in memcheck, unless we have X-Git-Tag: svn/VALGRIND_3_13_0~222 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=488f1cc4dc5adc05c96d59a1193873bef7451d86;p=thirdparty%2Fvalgrind.git Do not capture the free stacktrace in memcheck, unless we have either to keep the free stacktrace and/or to compute full xtree memory. Also, properly compute avg nr of IP per execontext: the avg must be computed using the real nr of execontext stored, not the hash table size. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16199 --- diff --git a/coregrind/m_execontext.c b/coregrind/m_execontext.c index e326a52d9c..ee6cc9b976 100644 --- a/coregrind/m_execontext.c +++ b/coregrind/m_execontext.c @@ -186,7 +186,7 @@ void VG_(print_ExeContext_stats) ( Bool with_stacktraces ) " exectx: %'lu lists, %'llu contexts (avg %3.2f per list)" " (avg %3.2f IP per context)\n", ec_htab_size, ec_totstored, (Double)ec_totstored / (Double)ec_htab_size, - (Double)total_n_ips / (Double)ec_htab_size + (Double)total_n_ips / (Double)ec_totstored ); VG_(message)(Vg_DebugMsg, " exectx: %'llu searches, %'llu full compares (%'llu per 1000)\n", diff --git a/memcheck/mc_malloc_wrappers.c b/memcheck/mc_malloc_wrappers.c index e11fb23850..52e2c02a9e 100644 --- a/memcheck/mc_malloc_wrappers.c +++ b/memcheck/mc_malloc_wrappers.c @@ -318,7 +318,11 @@ void MC_(set_freed_at) (ThreadId tid, MC_Chunk* mc) switch (MC_(clo_keep_stacktraces)) { case KS_none: return; - case KS_alloc: pos = -1; break; + case KS_alloc: + if (LIKELY(VG_(clo_xtree_memory) + != Vg_XTMemory_Full)) + return; + pos = -1; break; case KS_free: pos = 0; break; case KS_alloc_then_free: pos = 0; break; case KS_alloc_and_free: pos = 1; break; @@ -332,7 +336,7 @@ void MC_(set_freed_at) (ThreadId tid, MC_Chunk* mc) ec_free = VG_(record_ExeContext) ( tid, 0/*first_ip_delta*/ ); if (UNLIKELY(VG_(clo_xtree_memory) == Vg_XTMemory_Full)) VG_(XTMemory_Full_free)(mc->szB, mc->where[0], ec_free); - if (pos >= 0) + if (LIKELY(pos >= 0)) mc->where[pos] = ec_free; }