Skip to content

Commit

Permalink
Fix ONNX Runtime Op memory leak (#2406)
Browse files Browse the repository at this point in the history
  • Loading branch information
grimoire authored Sep 6, 2023
1 parent 6fdf459 commit a3c2fae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ void MMCVModulatedDeformConvKernel::Compute(OrtKernelContext *context) {
group, deformable_group, channels, num_output, kernel_height,
kernel_width, stride_height, stride_width, padding_height,
padding_width, dilation_height, dilation_width, columns, out_ptr);

allocator_.Free(columns);
}
REGISTER_ONNXRUNTIME_OPS(mmdeploy, MMCVModulatedDeformConvOp);
REGISTER_ONNXRUNTIME_OPS(mmcv, MMCVModulatedDeformConvOp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,10 @@ void NMSRotatedKernel::Compute(OrtKernelContext* context) {
int64_t* res_data = ort_.GetTensorMutableData<int64_t>(res);

memcpy(res_data, res_order.data(), sizeof(int64_t) * res_order.size());

allocator_.Free(tmp_boxes);
allocator_.Free(sc);
allocator_.Free(select);
}

REGISTER_ONNXRUNTIME_OPS(mmdeploy, NMSRotatedOp);
Expand Down

0 comments on commit a3c2fae

Please sign in to comment.