mirror of
https://github.com/pgvector/pgvector.git
synced 2026-06-06 05:51:21 +08:00
Added VectorArrayFree
This commit is contained in:
@@ -362,7 +362,7 @@ InitBuildState(IvfflatBuildState * buildstate, Relation heap, Relation index, In
|
||||
static void
|
||||
FreeBuildState(IvfflatBuildState * buildstate)
|
||||
{
|
||||
pfree(buildstate->centers);
|
||||
VectorArrayFree(buildstate->centers);
|
||||
pfree(buildstate->listInfo);
|
||||
pfree(buildstate->normvec);
|
||||
|
||||
@@ -401,7 +401,7 @@ ComputeCenters(IvfflatBuildState * buildstate)
|
||||
IvfflatBench("k-means", IvfflatKmeans(buildstate->index, buildstate->samples, buildstate->centers));
|
||||
|
||||
/* Free samples before we allocate more memory */
|
||||
pfree(buildstate->samples);
|
||||
VectorArrayFree(buildstate->samples);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -212,6 +212,7 @@ typedef IvfflatScanOpaqueData * IvfflatScanOpaque;
|
||||
/* Methods */
|
||||
void _PG_init(void);
|
||||
VectorArray VectorArrayInit(int maxlen, int dimensions);
|
||||
void VectorArrayFree(VectorArray arr);
|
||||
void PrintVectorArray(char *msg, VectorArray arr);
|
||||
void IvfflatKmeans(Relation index, VectorArray samples, VectorArray centers);
|
||||
FmgrInfo *IvfflatOptionalProcInfo(Relation rel, uint16 procnum);
|
||||
|
||||
@@ -443,7 +443,7 @@ ElkanKmeans(Relation index, VectorArray samples, VectorArray centers)
|
||||
break;
|
||||
}
|
||||
|
||||
pfree(newCenters);
|
||||
VectorArrayFree(newCenters);
|
||||
pfree(centerCounts);
|
||||
pfree(closestCenters);
|
||||
pfree(lowerBound);
|
||||
|
||||
@@ -18,6 +18,15 @@ VectorArrayInit(int maxlen, int dimensions)
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* Free a vector array
|
||||
*/
|
||||
void
|
||||
VectorArrayFree(VectorArray arr)
|
||||
{
|
||||
pfree(arr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print vector array - useful for debugging
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user