pgvector.git / summary / log / commit / refs
commit db83f4faa82fdcc026e5cfc017c2e51280174897
Author: Andrew Kane <andrew@ankane.org>
Date: Tue May 25 01:40:34 2021 +0000
Reduced memory usage during index build - #7
CHANGELOG.md | 4 ++++
src/ivfbuild.c | 8 ++++++++
2 files changed, 12 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9522e3a1..479e0233 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 b64b5f48..2755b285 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);
}
/*
[parent: 2cf71ec6bd45]