内存泄漏解决测试
This commit is contained in:
parent
1110ca1b9c
commit
02a7738c49
|
|
@ -213,10 +213,11 @@ func subscribeAndHandleMessagesV3(ws *websocket.Conn, device_id int) {
|
|||
//定时器,发送计数器
|
||||
t_count := 0
|
||||
t := 0
|
||||
img := gocv.NewMat()
|
||||
//计算帧率
|
||||
for {
|
||||
//从service获取当前帧
|
||||
img, c := service.GetDeviceCurrentFrameV3(device_id)
|
||||
c := service.GetDeviceCurrentFrameV2(&img, device_id)
|
||||
if c != count {
|
||||
if c == -1 {
|
||||
log.Printf("device:%d get frame err!", device_id)
|
||||
|
|
@ -269,6 +270,11 @@ func subscribeAndHandleMessagesV3(ws *websocket.Conn, device_id int) {
|
|||
t_count++
|
||||
}
|
||||
|
||||
err5 := img.Close()
|
||||
if err5 != nil {
|
||||
log.Printf("img close err:%v", err5)
|
||||
}
|
||||
|
||||
// 查看是否还有其他连接,没有则设置 is_play 为 0
|
||||
if worker.IsContainKey(online_conn_key) == false {
|
||||
worker.SetRedisWithExpire(strconv.Itoa(device_id)+"_is_play", "1", time.Minute*5)
|
||||
|
|
|
|||
Loading…
Reference in New Issue