Skip to content

Commit ef34efa

Browse files
author
elsa
committed
wip: apply nayef's suggestion to init memory all the time
1 parent 1b2b04f commit ef34efa

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/datadog/tracer.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@
3131
#include "w3c_propagation.h"
3232

3333
const void* elastic_apm_profiling_correlation_process_storage_v1 = nullptr;
34-
thread_local struct datadog::tracing::TLSStorage*
35-
elastic_apm_profiling_correlation_tls_v1 = nullptr;
3634
thread_local std::unique_ptr<datadog::tracing::TLSStorage> tls_info_holder =
37-
nullptr;
35+
std::make_unique<datadog::tracing::TLSStorage>();
36+
thread_local struct datadog::tracing::TLSStorage*
37+
elastic_apm_profiling_correlation_tls_v1 = tls_info_holder.get();
3838

3939
namespace datadog {
4040
namespace tracing {
@@ -120,9 +120,6 @@ Tracer::Tracer(const FinalizedTracerConfig& config,
120120
}
121121

122122
void Tracer::correlate(const Span& span) {
123-
tls_info_holder = std::make_unique<datadog::tracing::TLSStorage>();
124-
elastic_apm_profiling_correlation_tls_v1 = tls_info_holder.get();
125-
126123
struct TLSStorage* tls_data = elastic_apm_profiling_correlation_tls_v1;
127124
tls_data->valid = 0;
128125

0 commit comments

Comments
 (0)