mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
volume: fix memory leak
This commit is contained in:
parent
d214cefc2e
commit
43e6261579
|
@ -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…
Reference in a new issue