Do not call gc_collect_cycles in the loop to process the results, but only after all processBatch calls

This commit is contained in:
Jan Böhmer 2024-09-09 00:57:35 +02:00
parent 4d3114b49c
commit 9ae7f320cf

View file

@ -382,8 +382,15 @@ class OEMSecretsProvider implements InfoProviderInterface
} }
} }
//Force garbage collection to free up memory
gc_collect_cycles();
// Sort of the results // Sort of the results
$this->sortResultsData($results, $keyword); $this->sortResultsData($results, $keyword);
//Force garbage collection to free up memory
gc_collect_cycles();
return $results; return $results;
} }
@ -645,11 +652,6 @@ class OEMSecretsProvider implements InfoProviderInterface
vendor_infos: $purchaseInfoResults[$provider_id] ?? [] vendor_infos: $purchaseInfoResults[$provider_id] ?? []
); );
// Force garbage collection to deallocate unused memory cycles
// Without this instruction, when in dev mode, after the first or second call to getDetails,
// a memory error occurs due to memory not being freed properly, leading to memory exhaustion.
gc_collect_cycles();
return $partDetailDTO; return $partDetailDTO;
} }