1 diff --git a/BaiduPCS-Go b/BaiduPCS-Go
4 Binary files /dev/null and b/BaiduPCS-Go differ
5 diff --git a/pcsutil/cachepool/malloc.go b/pcsutil/cachepool/malloc.go
6 index 307a2d4..612fdd9 100644
7 --- a/pcsutil/cachepool/malloc.go
8 +++ b/pcsutil/cachepool/malloc.go
16 @@ -5,6 +8,8 @@ import (
20 +// 函数声明可以省略主体。 这样的声明为Go外部实现的功能(例如汇编例程)提供了签名。这是在汇编中实现函数的方式。
22 //go:linkname mallocgc runtime.mallocgc
23 func mallocgc(size uintptr, typ uintptr, needzero bool) unsafe.Pointer
25 @@ -30,4 +35,4 @@ func RawMallocByteSlice(size int) []byte {
31 \ No newline at end of file
32 diff --git a/pcsutil/cachepool/malloc_go_1.23.go b/pcsutil/cachepool/malloc_go_1.23.go
34 index 0000000..8c2b78d
36 +++ b/pcsutil/cachepool/malloc_go_1.23.go
48 +// 由于GO 1.23版本取消了 go:linkname 的支持,所以1.23以及以上版本需要使用本文件替代原始文件 malloc.go
50 +// RawByteSlice point to runtime.rawbyteslice
51 +func RawByteSlice(size int) (b []byte) {
52 + bytesArray := make([]byte, size)
56 +// RawMalloc allocates a new slice. The slice is not zeroed.
57 +func RawMalloc(size int) unsafe.Pointer {
58 + bytesArray := make([]byte, size)
59 + // 使用unsafe.Pointer获取字节数组的指针
60 + bytesPtr := unsafe.Pointer(&bytesArray[0])
64 +// RawMallocByteSlice allocates a new byte slice. The slice is not zeroed.
65 +func RawMallocByteSlice(size int) []byte {
66 + bytesArray := make([]byte, size)
69 \ No newline at end of file