Browse Source

volume: fix memory leak

tikv
Chris Lu 5 years ago
parent
commit
43e6261579
  1. 3
      weed/storage/volume_vacuum.go

3
weed/storage/volume_vacuum.go

@ -342,6 +342,7 @@ func (v *Volume) copyDataAndGenerateIndexFile(dstName, idxName string, prealloca
defer dst.Close() defer dst.Close()
nm := needle_map.NewMemDb() nm := needle_map.NewMemDb()
defer nm.Close()
scanner := &VolumeFileScanner4Vacuum{ scanner := &VolumeFileScanner4Vacuum{
v: v, v: v,
@ -370,7 +371,9 @@ func copyDataBasedOnIndexFile(srcDatName, srcIdxName, dstDatName, datIdxName str
defer dstDatBackend.Close() defer dstDatBackend.Close()
oldNm := needle_map.NewMemDb() oldNm := needle_map.NewMemDb()
defer oldNm.Close()
newNm := needle_map.NewMemDb() newNm := needle_map.NewMemDb()
defer newNm.Close()
if err = oldNm.LoadFromIdx(srcIdxName); err != nil { if err = oldNm.LoadFromIdx(srcIdxName); err != nil {
return return
} }

Loading…
Cancel
Save