protected function MemoryLimitDatabaseQueue::attemptMemoryReclaim in Acquia Content Hub 8
Tries to reclaim memory.
Return value
int The memory usage after reclaim.
1 call to MemoryLimitDatabaseQueue::attemptMemoryReclaim()
- MemoryLimitDatabaseQueue::claimItem in src/
Queue/ MemoryLimitDatabaseQueue.php - Claims an item in the queue for processing.
File
- src/
Queue/ MemoryLimitDatabaseQueue.php, line 60
Class
- MemoryLimitDatabaseQueue
- Overridden queue implementation that evaluates memory usage.
Namespace
Drupal\acquia_contenthub\QueueCode
protected function attemptMemoryReclaim() {
// Entity storage can blow up with caches so clear them out.
$manager = \Drupal::entityTypeManager();
foreach ($manager
->getDefinitions() as $id => $definition) {
$manager
->getStorage($id)
->resetCache();
}
// @todo explore resetting the container.
// Run garbage collector to further reduce memory.
gc_collect_cycles();
return memory_get_usage();
}