WordPress at Your Fingertips
function is not described

WP_Background_Process::memory_exceeded() protected WC 1.0

Memory exceeded

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

{} It's a method of the class: WP_Background_Process{}

Hooks from the method

Return

true|false.

Usage

// protected - for code of main (parent) or child class
$result = $this->memory_exceeded();

Code of WP_Background_Process::memory_exceeded() WC 5.8.0

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 );
}