mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-01 10:11:20 +08:00
Improved code [skip ci]
This commit is contained in:
@@ -375,13 +375,14 @@ InsertTupleInMemory(Relation index, Datum *values, ItemPointer heaptid, HnswBuil
|
||||
/* Add to graph memory context */
|
||||
oldCtx = MemoryContextSwitchTo(buildstate->graphCtx);
|
||||
|
||||
if (dup != NULL)
|
||||
if (dup == NULL)
|
||||
buildstate->elements = lappend(buildstate->elements, element);
|
||||
else
|
||||
{
|
||||
/* No need to free element since memory unlikely to be reallocated */
|
||||
/* Element is also used to estimate memory usage below */
|
||||
HnswAddHeapTid(dup, heaptid);
|
||||
}
|
||||
else
|
||||
buildstate->elements = lappend(buildstate->elements, element);
|
||||
|
||||
MemoryContextSwitchTo(oldCtx);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user