You've already forked json-iterator
mirror of
https://github.com/json-iterator/go.git
synced 2025-07-06 23:37:39 +02:00
avoid gc issue
This commit is contained in:
@ -142,7 +142,8 @@ func reuseSlice(slice *sliceHeader, sliceType reflect.Type, expectedCap int) {
|
|||||||
if expectedCap <= slice.Cap {
|
if expectedCap <= slice.Cap {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
dst := unsafe.Pointer(reflect.MakeSlice(sliceType, 0, expectedCap).Pointer())
|
newVal := reflect.MakeSlice(sliceType, 0, expectedCap)
|
||||||
|
dst := unsafe.Pointer(newVal.Pointer())
|
||||||
slice.Cap = expectedCap
|
slice.Cap = expectedCap
|
||||||
slice.Data = dst
|
slice.Data = dst
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user