New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CAPI 重OneDimDetectionResult 调用释放内存释方法后崩溃 #2437
Comments
比如我给打上日志 void FD_C_DestroyDetectionResult(
__fd_take FD_C_DetectionResult* fd_c_detection_result) {
if (fd_c_detection_result == nullptr)
return;
std::cout<<"5"<<std::endl;
// delete boxes
for (size_t i = 0; i < fd_c_detection_result->boxes.size; i++) {
delete[] fd_c_detection_result->boxes.data[i].data;
}
delete[] fd_c_detection_result->boxes.data;
std::cout<<"6"<<std::endl;
// delete rotated_boxes
for (size_t i = 0; i < fd_c_detection_result->rotated_boxes.size; i++) {
delete[] fd_c_detection_result->rotated_boxes.data[i].data;
}
delete[] fd_c_detection_result->rotated_boxes.data;
std::cout<<"7"<<std::endl;
// delete scores
delete[] fd_c_detection_result->scores.data;
std::cout<<"8"<<std::endl;
// delete label_ids
delete[] fd_c_detection_result->label_ids.data;
std::cout<<"9"<<std::endl;
// delete masks
for (size_t i = 0; i < fd_c_detection_result->masks.size; i++) {
delete[] fd_c_detection_result->masks.data[i].data.data;
delete[] fd_c_detection_result->masks.data[i].shape.data;
}
delete fd_c_detection_result;
std::cout<<"10"<<std::endl;
} 日志信息如下:
|
这个倒没遇到过,可以检查下看是否出现重复delete了? |
void FD_C_DestroyDetectionResult(
__fd_take FD_C_DetectionResult* fd_c_detection_result) {
if (fd_c_detection_result == nullptr) return;
// delete boxes
for (size_t i = 0; i < fd_c_detection_result->boxes.size; i++) {
delete[] fd_c_detection_result->boxes.data[i].data;
}
delete[] fd_c_detection_result->boxes.data;
// delete scores
delete[] fd_c_detection_result->scores.data;
// delete label_ids
delete[] fd_c_detection_result->label_ids.data;
// delete masks
for (size_t i = 0; i < fd_c_detection_result->masks.size; i++) {
delete[] fd_c_detection_result->masks.data[i].data.data;
delete[] fd_c_detection_result->masks.data[i].shape.data;
}
delete fd_c_detection_result;
}
void FD_C_DestroyOneDimDetectionResult(
__fd_take FD_C_OneDimDetectionResult* fd_c_one_dim_detection_result) {
for (int i = 0; i < fd_c_one_dim_detection_result->size; i++) {
FD_C_DestroyDetectionResult(fd_c_one_dim_detection_result->data + i);
}
delete[] fd_c_one_dim_detection_result->data;
delete fd_c_one_dim_detection_result;
} 如果在 |
我添加一个释放方法
在调用
FD_C_DestroyOneDimDetectionResult
的时候,走到FD_C_DestroyDetectionResult
的最后一行delete fd_c_detection_result;
出问题了,具体问题:delete fd_c_detection_result;
有大伙知道啥情况吗?有没有人测过?
The text was updated successfully, but these errors were encountered: