WP_Background_Process::memory_exceeded()

Memory exceeded

Description

Ensures the batch process never exceeds 90% of the maximum WordPress memory.

Return

(bool)

Source

File: bp-core/libraries/wp-background-process.php

355
356
357
358
359
360
361
362
363
364
365
protected function memory_exceeded() {
    $memory_limit   = $this->get_memory_limit() * 0.9; // 90% of max memory
    $current_memory = memory_get_usage( true );
    $return         = false;
 
    if ( $current_memory >= $memory_limit ) {
        $return = true;
    }
 
    return apply_filters( $this->identifier . '_memory_exceeded', $return );
}

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.