aboutsummaryrefslogtreecommitdiff
path: root/weed/command
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-03-09 22:29:02 -0700
committerChris Lu <chris.lu@gmail.com>2020-03-09 22:29:02 -0700
commit0871d2cff091e43190065bd17dba624cf6da1d6d (patch)
tree3979790d89967d24e804f8e19c43ba3f729e1212 /weed/command
parent1f8fc4b5edfeb9838345de146beb1ec033231dd3 (diff)
downloadseaweedfs-0871d2cff091e43190065bd17dba624cf6da1d6d.tar.xz
seaweedfs-0871d2cff091e43190065bd17dba624cf6da1d6d.zip
volume: fix memory leak during compaction
fix https://github.com/chrislusf/seaweedfs/issues/1222
Diffstat (limited to 'weed/command')
-rw-r--r--weed/command/export.go2
-rw-r--r--weed/command/fix.go1
2 files changed, 3 insertions, 0 deletions
diff --git a/weed/command/export.go b/weed/command/export.go
index 8d664ad3b..8c32b3f4d 100644
--- a/weed/command/export.go
+++ b/weed/command/export.go
@@ -195,6 +195,8 @@ func runExport(cmd *Command, args []string) bool {
vid := needle.VolumeId(*export.volumeId)
needleMap := needle_map.NewMemDb()
+ defer needleMap.Close()
+
if err := needleMap.LoadFromIdx(path.Join(*export.dir, fileName+".idx")); err != nil {
glog.Fatalf("cannot load needle map from %s.idx: %s", fileName, err)
}
diff --git a/weed/command/fix.go b/weed/command/fix.go
index 8903595fa..90d1c4893 100644
--- a/weed/command/fix.go
+++ b/weed/command/fix.go
@@ -70,6 +70,7 @@ func runFix(cmd *Command, args []string) bool {
indexFileName := path.Join(*fixVolumePath, baseFileName+".idx")
nm := needle_map.NewMemDb()
+ defer nm.Close()
vid := needle.VolumeId(*fixVolumeId)
scanner := &VolumeFileScanner4Fix{