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