diff --git a/src/buffer/memory/buffer.go b/src/buffer/memory/buffer.go index 2a76711..31ddb93 100644 --- a/src/buffer/memory/buffer.go +++ b/src/buffer/memory/buffer.go @@ -21,7 +21,9 @@ func (i *memory) Write(row buffer.RowSlice) { } func (i *memory) Read() []buffer.RowSlice { - return i.buffer + snapshot := make([]buffer.RowSlice, len(i.buffer)) + copy(snapshot, i.buffer) + return snapshot } func (i *memory) Len() int { @@ -29,5 +31,5 @@ func (i *memory) Len() int { } func (i *memory) Flush() { - i.buffer = make([]buffer.RowSlice, 0, i.size) + i.buffer = i.buffer[:0] }