mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-08 18:11:00 +08:00
[Bug Fix] Fix memory leak problem for paddleseg model (#1421)
Fix memory leak problem for paddleseg model Co-authored-by: root <root@bjyz-sys-gpu-kongming3.bjyz.baidu.com>
This commit is contained in:
@@ -163,16 +163,16 @@ bool PaddleSegPostprocessor::FDTensorCast2Uint8(FDTensor* infer_result,
|
|||||||
// cv::resize don't support `CV_8S` or `CV_32S`
|
// cv::resize don't support `CV_8S` or `CV_32S`
|
||||||
// refer to https://github.com/opencv/opencv/issues/20991
|
// refer to https://github.com/opencv/opencv/issues/20991
|
||||||
// https://github.com/opencv/opencv/issues/7862
|
// https://github.com/opencv/opencv/issues/7862
|
||||||
uint8_result_buffer = new std::vector<uint8_t>(
|
uint8_result_buffer->resize(offset * sizeof(int64_t));
|
||||||
infer_result_buffer, infer_result_buffer + offset);
|
memcpy(uint8_result_buffer->data(), infer_result_buffer, offset * sizeof(int64_t));
|
||||||
} else if (infer_result_dtype == FDDataType::INT32) {
|
} else if (infer_result_dtype == FDDataType::INT32) {
|
||||||
const int32_t* infer_result_buffer =
|
const int32_t* infer_result_buffer =
|
||||||
reinterpret_cast<const int32_t*>(infer_result->CpuData());
|
reinterpret_cast<const int32_t*>(infer_result->CpuData());
|
||||||
// cv::resize don't support `CV_8S` or `CV_32S`
|
// cv::resize don't support `CV_8S` or `CV_32S`
|
||||||
// refer to https://github.com/opencv/opencv/issues/20991
|
// refer to https://github.com/opencv/opencv/issues/20991
|
||||||
// https://github.com/opencv/opencv/issues/7862
|
// https://github.com/opencv/opencv/issues/7862
|
||||||
uint8_result_buffer = new std::vector<uint8_t>(
|
uint8_result_buffer->resize(offset * sizeof(int32_t));
|
||||||
infer_result_buffer, infer_result_buffer + offset);
|
memcpy(uint8_result_buffer->data(), infer_result_buffer, offset * sizeof(int32_t));
|
||||||
} else {
|
} else {
|
||||||
FDASSERT(false,
|
FDASSERT(false,
|
||||||
"Require the data type for casting uint8 is int64, int32, but now "
|
"Require the data type for casting uint8 is int64, int32, but now "
|
||||||
|
Reference in New Issue
Block a user