Compare commits

...

2 Commits

Author SHA1 Message Date
lijun 87c3522374 内存泄漏问题 2025-01-18 15:13:51 +08:00
lijun 59ae9d7f6f 内存泄漏问题 2025-01-18 15:10:15 +08:00
1 changed files with 13 additions and 0 deletions

View File

@ -65,8 +65,16 @@ func SetDeviceCurrentFrameV2(frame *gocv.Mat, device_id int) error {
//设置当前帧
switch device_id {
case 1:
err := Device1CurrentFrame.Close()
if err != nil {
log.Printf("设备:%d, 错误: 无法关闭帧\n", device_id)
}
Device1CurrentFrame = *frame
case 50:
err := Device50CurrentFrame.Close()
if err != nil {
log.Printf("设备:%d, 错误: 无法关闭帧\n", device_id)
}
Device50CurrentFrame = *frame
}
frame_count, ok := DeviceFrameCount.Load(device_id)
@ -258,6 +266,11 @@ func getVideoFrame(device proto.DeviceInfo) {
log.Printf("设备:%d 错误: 无法设置当前帧,err:%s \n", device.ID, err3.Error())
}
z++
//关闭帧
err4 := frame.Close()
if err4 != nil {
log.Printf("设备:%d 错误: 无法关闭帧,err:%s \n", device.ID, err4.Error())
}
}
//关闭帧
err4 := frame.Close()