mirror of
https://github.com/json-iterator/go.git
synced 2025-04-26 11:42:56 +02:00
#140 try fix: maybe memory collected before assigned to existing object graph
This commit is contained in:
parent
4892de725b
commit
5124683f24
@ -124,7 +124,8 @@ func growOne(slice *sliceHeader, sliceType reflect.Type, elementType reflect.Typ
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dst := unsafe.Pointer(reflect.MakeSlice(sliceType, newLen, newCap).Pointer())
|
newVal := reflect.MakeSlice(sliceType, newLen, newCap)
|
||||||
|
dst := unsafe.Pointer(newVal.Pointer())
|
||||||
// copy old array into new array
|
// copy old array into new array
|
||||||
originalBytesCount := uintptr(slice.Len) * elementType.Size()
|
originalBytesCount := uintptr(slice.Len) * elementType.Size()
|
||||||
srcPtr := (*[1 << 30]byte)(slice.Data)
|
srcPtr := (*[1 << 30]byte)(slice.Data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user