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

revert-22778-infer_var_type
ShenLiang 5 years ago committed by GitHub
parent 1507f77a18
commit 7f0b2c7407
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -326,6 +326,8 @@ void DatasetImpl<T>::ReleaseMemory() {
std::vector<paddle::framework::Channel<PvInstance>>().swap(multi_pv_consume_);
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";
}

@ -272,6 +272,7 @@ class DatasetImpl : public Dataset {
std::mutex global_index_mutex_;
int64_t global_index_ = 0;
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
@ -296,9 +297,6 @@ class MultiSlotDataset : public DatasetImpl<Record> {
virtual void GetRandomData(const std::set<uint16_t>& slots_to_replace,
std::vector<Record>* result);
virtual ~MultiSlotDataset() {}
protected:
std::vector<Record> input_records_; // the real data
};
} // end namespace framework

Loading…
Cancel
Save