From f2961d3d1d0d3acb8ac27008f8df9cfb9533b803 Mon Sep 17 00:00:00 2001
From: zhangmeng <775834166@qq.com>
Date: 星期四, 18 一月 2024 14:23:30 +0800
Subject: [PATCH] less memory
---
api/bhsgo/bhome_node.go | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/api/bhsgo/bhome_node.go b/api/bhsgo/bhome_node.go
index 2b0d494..6ea1b70 100644
--- a/api/bhsgo/bhome_node.go
+++ b/api/bhsgo/bhome_node.go
@@ -8,13 +8,16 @@
import "C"
import (
+ "fmt"
"unsafe"
bh "basic.com/valib/c_bhomebus.git/proto/source/bhome_msg"
)
func unsafeGetBytes(p *unsafe.Pointer, s int) []byte {
- return (*[0x7fffffff]byte)(*p)[:s:s]
+ fmt.Println("creply", *p, "len", s)
+ d := (*[0x7fffffff]byte)(*p)[:s:s]
+ return d
}
func ByteSlice2String(bs []byte) string {
@@ -72,7 +75,10 @@
defer C.BHFree(creply, creply_len)
if r {
// reply.Unmarshal(C.GoBytes(creply, creply_len))
- reply.Unmarshal(unsafeGetBytes(&creply, int(creply_len)))
+ fmt.Println("creply", creply, "len", creply_len)
+ d := unsafeGetBytes(&creply, int(creply_len))
+ fmt.Println("data len", len(d))
+ reply.Unmarshal(d)
}
return r
}
--
Gitblit v1.8.0