diff options
author | Benoit Steiner <bsteiner@google.com> | 2017-03-29 16:48:27 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2017-03-29 18:08:31 -0700 |
commit | 1f6c19e3a9131db4fa0353982b7bf44d61fe2ce8 (patch) | |
tree | 9c0918438aaa72e848d11490f3acd95f0d6708cf /tensorflow | |
parent | bc9ee91499c3e22b63fb2c240bafeb1e9f650d8c (diff) |
Unregister the CUPTI callbacks if needed when the gpu tracer is deleted to prevent them from accessing freed memory.
Change: 151650677
Diffstat (limited to 'tensorflow')
-rw-r--r-- | tensorflow/core/common_runtime/gpu/gpu_tracer.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tensorflow/core/common_runtime/gpu/gpu_tracer.cc b/tensorflow/core/common_runtime/gpu/gpu_tracer.cc index 981a654988..e3bd7d7c98 100644 --- a/tensorflow/core/common_runtime/gpu/gpu_tracer.cc +++ b/tensorflow/core/common_runtime/gpu/gpu_tracer.cc @@ -288,6 +288,7 @@ class GPUTracerImpl : public GPUTracer, public port::Tracing::Engine { public: GPUTracerImpl(); + ~GPUTracerImpl(); // GPUTracer interface: Status Start() override; @@ -382,6 +383,12 @@ GPUTracerImpl::GPUTracerImpl() { enabled_ = false; } +GPUTracerImpl::~GPUTracerImpl() { + // Unregister the CUPTI callbacks if needed to prevent them from accessing + // freed memory. + Stop().IgnoreError(); +} + Status GPUTracerImpl::Start() { VLOG(1) << "GPUTracer::Start"; mutex_lock l(mu_); |