Skip to content

Commit fb4b899

Browse files
committed
reduce memory requirements for building index
1 parent eba125c commit fb4b899

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

ruminsert.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -577,9 +577,9 @@ rumBuildCallback(Relation index, HeapTuple htup, Datum *values,
577577
while ((list = rumGetBAEntry(&buildstate->accum,
578578
&attnum, &key, &category, &nlist)) != NULL)
579579
{
580-
ItemPointerData *iptrs = (ItemPointerData *)palloc(sizeof(ItemPointerData) *nlist);
581-
Datum *addInfo = (Datum *)palloc(sizeof(Datum) * nlist);
582-
bool *addInfoIsNull = (bool *)palloc(sizeof(bool) * nlist);
580+
ItemPointerData *iptrs = (ItemPointerData *)palloc(sizeof(*iptrs) *nlist);
581+
Datum *addInfo = (Datum *)palloc(sizeof(*addInfo) * nlist);
582+
bool *addInfoIsNull = (bool *)palloc(sizeof(*addInfoIsNull) * nlist);
583583
int i;
584584

585585
for (i = 0; i < nlist; i++)
@@ -594,6 +594,10 @@ rumBuildCallback(Relation index, HeapTuple htup, Datum *values,
594594
CHECK_FOR_INTERRUPTS();
595595
rumEntryInsert(&buildstate->rumstate, attnum, key, category,
596596
iptrs, addInfo, addInfoIsNull, nlist, &buildstate->buildStats);
597+
598+
pfree(addInfoIsNull);
599+
pfree(addInfo);
600+
pfree(iptrs);
597601
}
598602

599603
MemoryContextReset(buildstate->tmpCtx);

0 commit comments

Comments
 (0)