You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/11/07 18:10:37 UTC

[GitHub] szha closed pull request #13120: [MXNET-922] Fix memleak in profiler (v1.3.x)

szha closed pull request #13120: [MXNET-922] Fix memleak in profiler (v1.3.x)
URL: https://github.com/apache/incubator-mxnet/pull/13120
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/src/profiler/profiler.cc b/src/profiler/profiler.cc
index 974873bfba7..c42966152c1 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<DeviceStats[]>(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 ed04d9e1452..ee06891f106 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<DeviceStats[]> profile_stat;
   /*! \brief Stats not associated directly with a device */
   DeviceStats  general_stats_;
   /*! \brief Map category -> pid */


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services