From 5afdccfc46d3f7ae58a6ad6918afd36bae518a1b Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 4 Mar 2018 17:47:26 +0100 Subject: [PATCH] Properly initialize data. Unused bitbield bits and inactive string index/reference had thrash values in release builds, which prevented de-duplication of source location payloads. --- server/TracyEvent.hpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/server/TracyEvent.hpp b/server/TracyEvent.hpp index 742b1d9e..1a9f204a 100644 --- a/server/TracyEvent.hpp +++ b/server/TracyEvent.hpp @@ -17,11 +17,12 @@ struct StringRef { enum Type { Ptr, Idx }; - StringRef() : __data( 0 ) {} - StringRef( Type t, uint64_t data ) - : isidx( t == Idx ) - , active( 1 ) + StringRef() : strptr( 0 ), __data( 0 ) {} + StringRef( Type t, uint64_t data ) : __data( 0 ) { + isidx = t == Idx; + active = 1; + if( isidx ) { stridx = data; @@ -52,10 +53,11 @@ struct StringRef struct StringIdx { StringIdx() : __data( 0 ) {} - StringIdx( uint32_t idx ) - : idx( idx ) - , active( 1 ) - {} + StringIdx( uint32_t _idx ) : __data( 0 ) + { + idx = _idx; + active = 1; + } union {