From c7d53e0ec3e68e4db2b3120e163b176d2ceba7cd Mon Sep 17 00:00:00 2001 From: zhangyanhua Date: Wed, 15 Feb 2023 10:44:22 +0800 Subject: [PATCH] =?UTF-8?q?1.fix=20bug=EF=BC=9AThere=20is=20a=20memory=20l?= =?UTF-8?q?eak=20in=20this=20part=20of=20the=20code=20The=20image=20cache?= =?UTF-8?q?=20is=20applied=20in=20the=20lib=20library=20for=20transferring?= =?UTF-8?q?=20images,=20which=20needs=20to=20be=20released,=20otherwise=20?= =?UTF-8?q?there=20will=20be=20a=20memory=20leak=202.Modify=20data=20updat?= =?UTF-8?q?e=20strategy=20When=20the=20device's=20desire=20value=20is=20in?= =?UTF-8?q?consistent=20with=20the=20report=20value,=20edgecore=20will=20r?= =?UTF-8?q?e-deliver=20the=20desire=20value.=20This=20judgment=20will=20ca?= =?UTF-8?q?use=20the=20desire=20value=20to=20fail=20to=20be=20delivered,?= =?UTF-8?q?=20because=20the=20desire=20value=20saved=20by=20the=20mapper?= =?UTF-8?q?=20has=20not=20changed.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangyanhua --- mapper-sdk-go/internal/mqttadapter/subscribe.go | 4 ---- mappers/gige/driver/gigeclient.go | 1 + 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/mapper-sdk-go/internal/mqttadapter/subscribe.go b/mapper-sdk-go/internal/mqttadapter/subscribe.go index 33046683..b5381301 100644 --- a/mapper-sdk-go/internal/mqttadapter/subscribe.go +++ b/mapper-sdk-go/internal/mqttadapter/subscribe.go @@ -43,10 +43,6 @@ func SyncInfo(dic *di.Container, message mqtt.Message) { if i == len(deviceInstances[instanceID].Twins) { continue } - // Desired value is not changed. - if deviceInstances[instanceID].Twins[i].Desired.Value == twinValue { - continue - } if len(twinValue) > 30{ klog.V(4).Infof("Set %s:%s value to %s......", instanceID, twinName, twinValue[:30]) }else{ diff --git a/mappers/gige/driver/gigeclient.go b/mappers/gige/driver/gigeclient.go index a4a08df2..61615811 100644 --- a/mappers/gige/driver/gigeclient.go +++ b/mappers/gige/driver/gigeclient.go @@ -293,6 +293,7 @@ func (gigEClient *GigEVisionDevice) PostImage(DeviceSN string) { go func() { var buffer []byte var bufferHdr = (*reflect.SliceHeader)(unsafe.Pointer(&buffer)) + defer C.free_image((**C.char)(unsafe.Pointer(&imageBuffer))) bufferHdr.Data = uintptr(unsafe.Pointer(imageBuffer)) bufferHdr.Len = size bufferHdr.Cap = size