diff --git a/core/modules/migrate/src/MigrateExecutable.php b/core/modules/migrate/src/MigrateExecutable.php index 139a07d..434e3af 100644 --- a/core/modules/migrate/src/MigrateExecutable.php +++ b/core/modules/migrate/src/MigrateExecutable.php @@ -568,7 +568,17 @@ protected function attemptMemoryReclaim() { // First, try resetting Drupal's static storage - this frequently releases // plenty of memory to continue. drupal_static_reset(); + + // Entity storage can blow up with caches so clear them out. + $container = \Drupal::getContainer(); + /** @var \Drupal\Core\Entity\EntityManagerInterface $manager */ + $manager = $container->get('entity.manager'); + foreach ($manager->getDefinitions() as $id => $definition) { + $manager->getStorage($id)->resetCache(); + } + // @TODO: explore resetting the container. + return memory_get_usage(); }