Force reclamation of memory after loading (#17244)

Signed-off-by: xige-16 <xi.ge@zilliz.com>
pull/17247/head
xige-16 2022-05-27 12:50:00 +08:00 committed by GitHub
parent 6110e3a06d
commit e196caf604
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -22,6 +22,7 @@ import (
"fmt"
"path"
"runtime"
"runtime/debug"
"strconv"
"sync"
@ -141,6 +142,7 @@ func (loader *segmentLoader) loadSegment(req *querypb.LoadSegmentsRequest, segme
for _, s := range newSegments {
deleteSegment(s)
}
debug.FreeOSMemory()
}
for _, info := range req.Infos {
@ -235,6 +237,10 @@ func (loader *segmentLoader) loadSegmentInternal(segment *Segment,
return err
}
// TODO(xige-16): Optimize the data loading process and reduce data copying
// for now, there will be multiple copies in the process of data loading into segCore
defer debug.FreeOSMemory()
var fieldBinlogs []*datapb.FieldBinlog
if segment.getType() == segmentTypeSealed {
fieldID2IndexInfo := make(map[int64]*querypb.FieldIndexInfo)