diff --git a/go/arrow/memory/go_allocator.go b/go/arrow/memory/go_allocator.go index 1dea4a8d23385..1017eb688d2ff 100644 --- a/go/arrow/memory/go_allocator.go +++ b/go/arrow/memory/go_allocator.go @@ -32,10 +32,9 @@ func (a *GoAllocator) Allocate(size int) []byte { } func (a *GoAllocator) Reallocate(size int, b []byte) []byte { - if size == len(b) { - return b + if cap(b) >= size { + return b[:size] } - newBuf := a.Allocate(size) copy(newBuf, b) return newBuf