?flush=1 using over 1GB memory?

Silverstripe Version:
Reproduced in 4.3 to 4.5-rc1

Question:
On a new Silverstripe install (with Imagick enabled) adding a handful of large images to a standard page, then running ?flush=1 seems to bypass the 256MB PHP memory limit and (on this particular server) ends up hitting the 1GB LVE memory limit (CloudLinux), causing the request to fail with a 503 error.

Is this expected behaviour?

  • Running ?flush=1 on a different page, with no images, works fine.

  • It had no issues generating the smaller versions of those images when they were added and the page viewed normally.

  • Adding the new ?execmetric=1 variable to the URL in my local dev version shows it as only reaching 30MB memory for the same request.

  • Adding Environment::setMemoryLimitMax('200M') to config.php doesn’t seem to make a difference.

  • Example page with issue: http://ss450.pswd.biz/image-test/

Are you using the FocusPoint module? @kinglozzer reported a memory issue recently, maybe related?

Not in this case, it’s literally a basic install with no extra modules, but I am experiencing that FocusPoint memory issue on another site!

Still struggling to stop SilverStripe ignoring the PHP memory limit when processing images.

I’ve managed to follow the trail to silverstripe-assets > InterventionBackend.php > getImageResource() > $this->setImageResource($resource);, but then get a bit lost.

It’s easy to reproduce, just add a few large images to a page’s Content field, then run ?flush=1 on the page while watching the memory usage. Locally I can see it fly up to 1.25GB, even if memory_limit is set to 256M, presume this shouldn’t be happening?

Anyone more familiar with the usage of Intervention Image or Flushing able to advise?