!19955 [MS][LITE][r1.3]fix memory leak in mindrt

Merge pull request !19955 from XianglongZeng/r1.3_
This commit is contained in:
i-robot 2021-07-14 01:15:07 +00:00 committed by Gitee
commit 4548cd4cda
2 changed files with 4 additions and 1 deletions

View File

@ -103,6 +103,9 @@ void LiteOpActor::IsolateInputData(std::vector<std::shared_ptr<LiteOpActor>> *ac
Tensor *new_tensor = new Tensor(new_data_type, old_tensor->shape(), old_tensor->format(), old_tensor->category());
new_tensor->set_allocator(old_tensor->allocator()); /* GPU use opencl allocator */
if (new_tensor->allocator() == nullptr && kernel_->subgraph_type() == kernel::kCpuFP16SubGraph) {
new_tensor->set_allocator(kernel_->Context()->allocator);
}
new_tensor->set_tensor_name(kernel_->name() + "_duplicate_" + old_tensor->tensor_name());
for (QuantArg quant : old_tensor->quant_params()) {
new_tensor->AddQuantParam(quant);

View File

@ -260,7 +260,6 @@ void AnfTransform::GetFuncGraphs(const FuncGraphPtr &func_graph, std::set<FuncGr
to_process.insert(to_process.end(), nodes.begin(), nodes.end());
while (!to_process.empty()) {
auto &cur_cnode = to_process.front();
to_process.pop_front();
for (auto &input : cur_cnode->inputs()) {
if (!IsValueNode<FuncGraph>(input)) {
continue;
@ -273,6 +272,7 @@ void AnfTransform::GetFuncGraphs(const FuncGraphPtr &func_graph, std::set<FuncGr
auto new_nodes = new_fg->GetOrderedCnodes();
to_process.insert(to_process.end(), new_nodes.begin(), new_nodes.end());
}
to_process.pop_front();
}
}