diff --git a/CHANGELOG.md b/CHANGELOG.md index 9522e3a..479e023 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.1.5 (unreleased) + +- Reduced memory usage during index build + ## 0.1.4 (2021-05-09) - Fixed kmeans for inner product diff --git a/src/ivfbuild.c b/src/ivfbuild.c index b64b5f4..2755b28 100644 --- a/src/ivfbuild.c +++ b/src/ivfbuild.c @@ -194,7 +194,10 @@ GetNextTuple(Tuplesortstate *sortstate, TupleDesc tupdesc, TupleTableSlot *slot, ItemPointerSet(&(*itup)->t_tid, tupblk, tupoff); } else + { *list = -1; + *itup = NULL; + } } /* @@ -243,6 +246,8 @@ InsertTuples(Relation index, IvfflatBuildState * buildstate, ForkNumber forkNum) buildstate->indtuples += 1; + pfree(itup); + GetNextTuple(buildstate->sortstate, tupdesc, slot, &itup, &list); } @@ -253,6 +258,9 @@ InsertTuples(Relation index, IvfflatBuildState * buildstate, ForkNumber forkNum) /* Set the start and insert pages */ IvfflatUpdateList(index, state, buildstate->listInfo[i], insertPage, startPage, forkNum); } + + if (itup != NULL) + pfree(itup); } /*