You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by gi...@git.apache.org on 2017/08/26 07:48:57 UTC

[GitHub] piiswrong commented on a change in pull request #7617: Fix memory leak in profiler

piiswrong commented on a change in pull request #7617: Fix memory leak in profiler
URL: https://github.com/apache/incubator-mxnet/pull/7617#discussion_r135384132
 
 

 ##########
 File path: src/engine/profiler.cc
 ##########
 @@ -161,44 +159,47 @@ void Profiler::DumpProfile() {
 
   uint32_t dev_num = cpu_num_ + gpu_num_ + 1;
 
-  for (uint32_t i = 0; i < dev_num; ++i) {
-    const DevStat &d = profile_stat[i];
-    this->EmitPid(&file, d.dev_name, i);
-    file << ",\n";
-  }
-
-  bool first_flag = true;
-  for (uint32_t i = 0; i < dev_num; ++i) {
-    DevStat &d = profile_stat[i];
-    std::lock_guard<std::mutex> lock(d.m_);
-    uint32_t opr_num = d.opr_exec_stats.size();
-
-    for (uint32_t j = 0; j < opr_num; ++j) {
-      const OprExecStat* opr_stat = d.opr_exec_stats[j];
-
-      uint32_t pid = i;
-      uint32_t tid = opr_stat->thread_id;
+  std::shared_ptr<DevStat> pstat = profile_stat_;  // hold a ref count
 
 Review comment:
   why
 
----------------------------------------------------------------
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