fix:[2.5]Add debug memory freeing in sortStats (#41285)

Add debug memory freeing in createJSONKeyIndex function
issue: https://github.com/milvus-io/milvus/issues/41218
pr:https://github.com/milvus-io/milvus/pull/41284

---------

Signed-off-by: Xianhui.Lin <xianhui.lin@zilliz.com>
pull/41368/head
Xianhui Lin 2025-04-16 15:00:34 +08:00 committed by GitHub
parent 741838a1dc
commit b3d3a268b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 0 deletions

View File

@ -20,6 +20,7 @@ import (
"context"
"fmt"
sio "io"
"runtime/debug"
"sort"
"strconv"
"time"
@ -322,6 +323,10 @@ func (st *statsTask) sortSegment(ctx context.Context) ([]*datapb.FieldBinlog, er
zap.Duration("sort elapse", sortTimeCost),
zap.Duration("serWrite elapse", serWriteTimeCost),
zap.Duration("total elapse", totalElapse))
writer = nil
values = nil
debug.FreeOSMemory()
return insertLogs, nil
}
@ -785,6 +790,7 @@ func (st *statsTask) createJSONKeyIndex(ctx context.Context,
log.Info("create json key index failed dataformat invalid")
return nil
}
fieldBinlogs := lo.GroupBy(insertBinlogs, func(binlog *datapb.FieldBinlog) int64 {
return binlog.GetFieldID()
})