$this->message->
display( $this->
t( 'Memory usage is @usage (@pct% of limit @limit), reclaiming memory.',
[ '@pct' =>
round($pct_memory * 100
),
'@usage' =>
$this->
formatSize($usage),
'@limit' =>
$this->
formatSize($this->memoryLimit
),
] ),
'warning'
);
$usage =
$this->
attemptMemoryReclaim();
$pct_memory =
$usage /
$this->memoryLimit;
// Use a lower threshold - we don't want to be in a situation where we keep
// coming back here and trimming a tiny amount
if ($pct_memory >
(0.90 *
$threshold)) { $this->message->
display( $this->
t( 'Memory usage is now @usage (@pct% of limit @limit), not enough reclaimed, starting new batch',
[ '@pct' =>
round($pct_memory * 100
),
'@usage' =>
$this->
formatSize($usage),
'@limit' =>
$this->
formatSize($this->memoryLimit
),
]