Skip to content

Commit

Permalink
1.fix bug:There is a memory leak in this part of the code
Browse files Browse the repository at this point in the history
The image cache is applied in the lib library for transferring images, which needs to be released, otherwise there will be a memory leak
2.Modify data update strategy
When the device's desire value is inconsistent with the report value, edgecore will re-deliver the desire value. This judgment will cause the desire value to fail to be delivered, because the desire value saved by the mapper has not changed.

Signed-off-by: zhangyanhua <[email protected]>
  • Loading branch information
orsline committed Feb 15, 2023
1 parent 772aa38 commit c7d53e0
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
4 changes: 0 additions & 4 deletions mapper-sdk-go/internal/mqttadapter/subscribe.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
1 change: 1 addition & 0 deletions mappers/gige/driver/gigeclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c7d53e0

Please sign in to comment.