提交 a9771d63 编写于 作者: K kai00

benchmark mem check fixed

上级 0c60f7e6
...@@ -287,6 +287,13 @@ LiteSession::~LiteSession() { ...@@ -287,6 +287,13 @@ LiteSession::~LiteSession() {
for (auto *kernel : kernels_) { for (auto *kernel : kernels_) {
delete kernel; delete kernel;
} }
for (auto *ms_tensor : input_vec_) {
if (ms_tensor != nullptr) {
((tensor::LiteTensor *)ms_tensor)->SetTensorImpl(nullptr);
delete ms_tensor;
}
}
input_vec_.clear();
delete this->context_; delete this->context_;
delete this->executor; delete this->executor;
this->executor = nullptr; this->executor = nullptr;
......
...@@ -102,10 +102,12 @@ int Benchmark::ReadInputFile() { ...@@ -102,10 +102,12 @@ int Benchmark::ReadInputFile() {
if (size != tensorDataSize) { if (size != tensorDataSize) {
std::cerr << "Input binary file size error, required: %zu, in fact: %zu" << tensorDataSize << size << std::endl; std::cerr << "Input binary file size error, required: %zu, in fact: %zu" << tensorDataSize << size << std::endl;
MS_LOG(ERROR) << "Input binary file size error, required: " << tensorDataSize << ", in fact: " << size; MS_LOG(ERROR) << "Input binary file size error, required: " << tensorDataSize << ", in fact: " << size;
delete binBuf;
return RET_ERROR; return RET_ERROR;
} }
auto inputData = cur_tensor->MutableData(); auto inputData = cur_tensor->MutableData();
memcpy(inputData, binBuf, tensorDataSize); memcpy(inputData, binBuf, tensorDataSize);
delete binBuf;
} }
} }
return RET_OK; return RET_OK;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册