diff --git a/erasure-readfile.go b/erasure-readfile.go index 73cf02281..690a88886 100644 --- a/erasure-readfile.go +++ b/erasure-readfile.go @@ -147,6 +147,9 @@ func (e erasure) ReadFile(volume, path string, startOffset int64, totalSize int6 return } + // Reset dataBlocks to relenquish memory. + dataBlocks = nil + // Reset offset to '0' to read rest of the blocks. startOffset = int64(0) diff --git a/erasure-utils.go b/erasure-utils.go index ff505b143..6a2839bbf 100644 --- a/erasure-utils.go +++ b/erasure-utils.go @@ -17,8 +17,7 @@ package main // getDataBlocks - fetches the data block only part of the input encoded blocks. -func getDataBlocks(enBlocks [][]byte, dataBlocks int, curBlockSize int) []byte { - var data []byte +func getDataBlocks(enBlocks [][]byte, dataBlocks int, curBlockSize int) (data []byte) { for _, block := range enBlocks[:dataBlocks] { data = append(data, block...) }