内存泄漏问题,深拷贝

This commit is contained in:
lijun 2025-01-18 16:01:42 +08:00
parent 5bd2707ffd
commit 1e8b72e9b2
1 changed files with 4 additions and 1 deletions

View File

@ -70,7 +70,10 @@ func SetDeviceCurrentFrameV2(frame *gocv.Mat, device_id int) error {
//if err != nil {
// log.Printf("设备:%d, 错误: 无法关闭帧\n", device_id)
//}
Device1CurrentFrame = *frame
if Device1CurrentFrame.Empty() {
Device1CurrentFrame = gocv.NewMatWithSize((*frame).Rows(), (*frame).Cols(), (*frame).Type())
}
(*frame).CopyTo(&Device1CurrentFrame)
//err := deepcopier.Copy(*frame).To(&Device1CurrentFrame)
//if err != nil {
// log.Printf("设备:%d, 错误: 无法设置帧,err: %s \n", device_id, err.Error())