未验证 提交 7f0b2c74 编写于 作者: S ShenLiang 提交者: GitHub

fix memory leaking problem of dataset, test=develop (#23955)

上级 1507f77a
...@@ -326,6 +326,8 @@ void DatasetImpl<T>::ReleaseMemory() { ...@@ -326,6 +326,8 @@ void DatasetImpl<T>::ReleaseMemory() {
std::vector<paddle::framework::Channel<PvInstance>>().swap(multi_pv_consume_); std::vector<paddle::framework::Channel<PvInstance>>().swap(multi_pv_consume_);
std::vector<std::shared_ptr<paddle::framework::DataFeed>>().swap(readers_); std::vector<std::shared_ptr<paddle::framework::DataFeed>>().swap(readers_);
input_records_.clear();
std::vector<T>().swap(input_records_);
VLOG(3) << "DatasetImpl<T>::ReleaseMemory() end"; VLOG(3) << "DatasetImpl<T>::ReleaseMemory() end";
} }
......
...@@ -272,6 +272,7 @@ class DatasetImpl : public Dataset { ...@@ -272,6 +272,7 @@ class DatasetImpl : public Dataset {
std::mutex global_index_mutex_; std::mutex global_index_mutex_;
int64_t global_index_ = 0; int64_t global_index_ = 0;
std::vector<std::shared_ptr<ThreadPool>> consume_task_pool_; std::vector<std::shared_ptr<ThreadPool>> consume_task_pool_;
std::vector<T> input_records_; // only for paddleboxdatafeed
}; };
// use std::vector<MultiSlotType> or Record as data type // use std::vector<MultiSlotType> or Record as data type
...@@ -296,9 +297,6 @@ class MultiSlotDataset : public DatasetImpl<Record> { ...@@ -296,9 +297,6 @@ class MultiSlotDataset : public DatasetImpl<Record> {
virtual void GetRandomData(const std::set<uint16_t>& slots_to_replace, virtual void GetRandomData(const std::set<uint16_t>& slots_to_replace,
std::vector<Record>* result); std::vector<Record>* result);
virtual ~MultiSlotDataset() {} virtual ~MultiSlotDataset() {}
protected:
std::vector<Record> input_records_; // the real data
}; };
} // end namespace framework } // end namespace framework
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册