| 650 | |
| 651 | template <typename T> |
| 652 | void DatasetImpl<T>::ReleaseMemoryFun() { |
| 653 | VLOG(3) << "DatasetImpl<T>::ReleaseMemory() begin"; |
| 654 | if (input_channel_) { |
| 655 | input_channel_->Clear(); |
| 656 | input_channel_ = nullptr; |
| 657 | } |
| 658 | for (size_t i = 0; i < multi_output_channel_.size(); ++i) { |
| 659 | if (!multi_output_channel_[i]) { |
| 660 | continue; |
| 661 | } |
| 662 | multi_output_channel_[i]->Clear(); |
| 663 | multi_output_channel_[i] = nullptr; |
| 664 | } |
| 665 | std::vector<paddle::framework::Channel<T>>().swap(multi_output_channel_); |
| 666 | for (size_t i = 0; i < multi_consume_channel_.size(); ++i) { |
| 667 | if (!multi_consume_channel_[i]) { |
| 668 | continue; |
| 669 | } |
| 670 | multi_consume_channel_[i]->Clear(); |
| 671 | multi_consume_channel_[i] = nullptr; |
| 672 | } |
| 673 | std::vector<paddle::framework::Channel<T>>().swap(multi_consume_channel_); |
| 674 | if (input_pv_channel_) { |
| 675 | input_pv_channel_->Clear(); |
| 676 | input_pv_channel_ = nullptr; |
| 677 | } |
| 678 | for (auto& pv_output : multi_pv_output_) { |
| 679 | if (!pv_output) { |
| 680 | continue; |
| 681 | } |
| 682 | pv_output->Clear(); |
| 683 | pv_output = nullptr; |
| 684 | } |
| 685 | std::vector<paddle::framework::Channel<PvInstance>>().swap(multi_pv_output_); |
| 686 | for (auto& pv_consume : multi_pv_consume_) { |
| 687 | if (!pv_consume) { |
| 688 | continue; |
| 689 | } |
| 690 | pv_consume->Clear(); |
| 691 | pv_consume = nullptr; |
| 692 | } |
| 693 | if (enable_heterps_) { |
| 694 | input_records_.clear(); |
| 695 | input_records_.shrink_to_fit(); |
| 696 | std::vector<T>().swap(input_records_); |
| 697 | VLOG(3) << "release heterps input records records size: " |
| 698 | << input_records_.size(); |
| 699 | } |
| 700 | std::vector<paddle::framework::Channel<PvInstance>>().swap(multi_pv_consume_); |
| 701 | |
| 702 | std::vector<std::shared_ptr<paddle::framework::DataFeed>>().swap(readers_); |
| 703 | input_records_.clear(); |
| 704 | std::vector<T>().swap(input_records_); |
| 705 | std::vector<T>().swap(slots_shuffle_original_data_); |
| 706 | VLOG(3) << "DatasetImpl<T>::ReleaseMemory() end"; |
| 707 | VLOG(3) << "total_feasign_num_(" << STAT_GET(STAT_total_feasign_num_in_mem) |
| 708 | << ") - current_fea_num_(" << total_fea_num_ << ") = (" |
| 709 | << STAT_GET(STAT_total_feasign_num_in_mem) - total_fea_num_ |
nothing calls this directly
no test coverage detected