aboutsummaryrefslogtreecommitdiff
path: root/go/storage/needle_byte_cache.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2016-05-13 00:19:57 -0700
committerChris Lu <chris.lu@gmail.com>2016-05-13 00:19:59 -0700
commitf8b03c45ef7e095542bc6c9a3d05412c04a9e211 (patch)
treed7e91b322792f2210227f79b9a8d98e92de3168d /go/storage/needle_byte_cache.go
parente639f1f889eb3705384a089d23c6bc4738ba9fa0 (diff)
downloadseaweedfs-f8b03c45ef7e095542bc6c9a3d05412c04a9e211.tar.xz
seaweedfs-f8b03c45ef7e095542bc6c9a3d05412c04a9e211.zip
properly release memory
fix https://github.com/chrislusf/seaweedfs/issues/301
Diffstat (limited to 'go/storage/needle_byte_cache.go')
-rw-r--r--go/storage/needle_byte_cache.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/go/storage/needle_byte_cache.go b/go/storage/needle_byte_cache.go
index d39ed23c4..5db0f8895 100644
--- a/go/storage/needle_byte_cache.go
+++ b/go/storage/needle_byte_cache.go
@@ -66,7 +66,9 @@ func getBytesForFileBlock(r *os.File, offset int64, readSize int) (dataSlice []b
}
func (n *Needle) ReleaseMemory() {
- n.rawBlock.decreaseReference()
+ if n.rawBlock != nil {
+ n.rawBlock.decreaseReference()
+ }
}
func ReleaseBytes(b []byte) {
bytesPool.Put(b)