Free OS memory in QueryNode and IndexNode (#14305)

Signed-off-by: bigsheeper <yihao.dai@zilliz.com>
pull/14640/head
bigsheeper 2021-12-30 20:03:29 +08:00 committed by GitHub
parent a2f2324131
commit 8a3a1b556a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 2 deletions

View File

@ -10,6 +10,7 @@
// or implied. See the License for the specific language governing permissions and limitations under the License
#include <string>
#include <malloc.h>
#include "index/knowhere/knowhere/index/vector_index/adapter/VectorAdapter.h"
#include "indexbuilder/IndexWrapper.h"
#include "indexbuilder/index_c.h"
@ -46,6 +47,7 @@ void
DeleteIndex(CIndex index) {
auto cIndex = (milvus::indexbuilder::IndexWrapper*)index;
delete cIndex;
malloc_trim(0);
}
CStatus

View File

@ -10,6 +10,7 @@
// or implied. See the License for the specific language governing permissions and limitations under the License
#include <iostream>
#include <malloc.h>
#include "segcore/collection_c.h"
#include "segcore/Collection.h"
@ -24,6 +25,7 @@ void
DeleteCollection(CCollection collection) {
auto col = (milvus::segcore::Collection*)collection;
delete col;
malloc_trim(0);
}
const char*

View File

@ -49,7 +49,7 @@ import (
// ---------- unittest util functions ----------
// common definitions
const ctxTimeInMillisecond = 500
const debug = false
const debugUT = false
const (
dimKey = "dim"

View File

@ -177,7 +177,7 @@ func newQueryNodeMock() *QueryNode {
var ctx context.Context
if debug {
if debugUT {
ctx = context.Background()
} else {
var cancel context.CancelFunc

View File

@ -21,6 +21,7 @@ import (
"errors"
"fmt"
"math/rand"
"runtime/debug"
"strconv"
"time"
@ -793,6 +794,8 @@ func (r *releaseCollectionTask) Execute(ctx context.Context) error {
}
r.node.historical.removeGlobalSegmentIDsByCollectionID(r.req.CollectionID)
debug.FreeOSMemory()
log.Debug("ReleaseCollection done", zap.Int64("collectionID", r.req.CollectionID))
return nil
}