Improved memory clean-up [skip ci]

This commit is contained in:
Andrew Kane
2023-08-06 14:09:42 -07:00
parent 72a8f68dc5
commit 0ffdefe138
2 changed files with 7 additions and 1 deletions

View File

@@ -183,6 +183,9 @@ CreateElementPages(HnswBuildState * buildstate)
UnlockReleaseBuffer(buf); UnlockReleaseBuffer(buf);
HnswUpdateMetaPage(index, true, buildstate->entryPoint, insertPage, forkNum); HnswUpdateMetaPage(index, true, buildstate->entryPoint, insertPage, forkNum);
pfree(etup);
pfree(ntup);
} }
/* /*
@@ -227,6 +230,8 @@ CreateNeighborPages(HnswBuildState * buildstate)
GenericXLogFinish(state); GenericXLogFinish(state);
UnlockReleaseBuffer(buf); UnlockReleaseBuffer(buf);
} }
pfree(ntup);
} }
/* /*
@@ -430,6 +435,7 @@ InitBuildState(HnswBuildState * buildstate, Relation heap, Relation index, Index
static void static void
FreeBuildState(HnswBuildState * buildstate) FreeBuildState(HnswBuildState * buildstate)
{ {
pfree(buildstate->normvec);
MemoryContextDelete(buildstate->tmpCtx); MemoryContextDelete(buildstate->tmpCtx);
} }

View File

@@ -611,7 +611,7 @@ HnswInitElement(ItemPointer heaptid, int m, double ml, int maxLevel)
void void
HnswFreeElement(HnswElement element) HnswFreeElement(HnswElement element)
{ {
list_free(element->heaptids); list_free_deep(element->heaptids);
for (int lc = 0; lc <= element->level; lc++) for (int lc = 0; lc <= element->level; lc++)
pfree(element->neighbors[lc].items); pfree(element->neighbors[lc].items);
pfree(element->neighbors); pfree(element->neighbors);