Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. MigrateExecutable.php

function MigrateExecutable::attemptMemoryReclaim

Tries to reclaim memory.

Return value

int The memory usage after reclaim.

1 call to MigrateExecutable::attemptMemoryReclaim()
MigrateExecutable::memoryExceeded in core/modules/migrate/src/MigrateExecutable.php
Tests whether we've exceeded the desired memory threshold.

File

core/modules/migrate/src/MigrateExecutable.php, line 607

Class

MigrateExecutable
Defines a migrate executable class.

Namespace

Drupal\migrate

Code

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 it out.
    \Drupal::service('entity.memory_cache')->deleteAll();
    // @todo Explore resetting the container.
    // Run garbage collector to further reduce memory.
    gc_collect_cycles();
    return memory_get_usage();
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal