mirror of
https://github.com/pgvector/pgvector.git
synced 2026-06-06 14:01:31 +08:00
Added HnswFreeNeighbors function [skip ci]
This commit is contained in:
@@ -143,6 +143,17 @@ HnswInitNeighbors(HnswElement element, int m)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Free neighbors
|
||||
*/
|
||||
static void
|
||||
HnswFreeNeighbors(HnswElement element)
|
||||
{
|
||||
for (int lc = 0; lc <= element->level; lc++)
|
||||
pfree(element->neighbors[lc].items);
|
||||
pfree(element->neighbors);
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate an element
|
||||
*/
|
||||
@@ -175,9 +186,7 @@ void
|
||||
HnswFreeElement(HnswElement element)
|
||||
{
|
||||
list_free_deep(element->heaptids);
|
||||
for (int lc = 0; lc <= element->level; lc++)
|
||||
pfree(element->neighbors[lc].items);
|
||||
pfree(element->neighbors);
|
||||
HnswFreeNeighbors(element);
|
||||
pfree(element->vec);
|
||||
pfree(element);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user