diff --git a/src/profiler/profiler.cc b/src/profiler/profiler.cc index 974873bfba7f..c42966152c11 100644 --- a/src/profiler/profiler.cc +++ b/src/profiler/profiler.cc @@ -67,7 +67,7 @@ Profiler::Profiler() this->gpu_num_ = 0; #endif - this->profile_stat = new DeviceStats[cpu_num_ + gpu_num_ + 2]; + this->profile_stat = std::unique_ptr(new DeviceStats[cpu_num_ + gpu_num_ + 2]); for (unsigned int i = 0; i < cpu_num_; ++i) { this->profile_stat[i].dev_name_ = "cpu/" + std::to_string(i); } diff --git a/src/profiler/profiler.h b/src/profiler/profiler.h index ed04d9e14527..ee06891f1067 100644 --- a/src/profiler/profiler.h +++ b/src/profiler/profiler.h @@ -455,7 +455,7 @@ class Profiler { /*! \brief filename to output profile file */ std::string filename_ = "profile.json"; /*! \brief profile statistics consist of multiple device statistics */ - DeviceStats* profile_stat; + std::unique_ptr profile_stat; /*! \brief Stats not associated directly with a device */ DeviceStats general_stats_; /*! \brief Map category -> pid */