4

I have a template in my control panel (technically a plugin, but it's just one template) which is running out of memory:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 78 bytes) in /var/sites/t/thames-arbitrators.org.uk/craft/app/helpers/ModelHelper.php on line 101

In my local dev site, the profiler is giving me the following info:

  • Time 10.66053s
  • Memory: 127,544Kb
  • Total Queries: 381

Is there anything I can do to alleviate this? I've seen the answer to 'PHP Fatal error: Allowed memory size of X bytes exhausted' but there are only two conditionals in this template, it's almost certainly down to the fact that I need to return several hundred entries.

I don't mind posting my template here but there's a big table in it so it's going to make the page super long - let me know which bits you need.

  • Hi, we have the same issue on a entries template in the admin. Looks like the UserSessionService::getAuthTimeout() is using an abnormal amount of requests. Need a patch ASAP! – Dan G Sep 23 '14 at 9:00
  • @DanG Your issue is most likely different and should be addressed in the next release. – Brad Bell Sep 23 '14 at 19:45
  • @BradBell Thanks, and thanks for the update! – Dan G Sep 23 '14 at 20:02
4

If your plugin is pulling in a lot of data, then most likely you're just bumping into your php.ini file's memory_limit setting. Try bumping that up to 256M and see if that helps.

  • Thanks Brad, I'll have to talk to the host and see if I can increase it. 134mb is already a hell of a lot though and the site's only been live for a month. It's going to increase by another hundred entries every month. Would pagination stop the overhead? – darylknight Sep 25 '14 at 8:12
  • Maybe? Caching would likely be the first place to look, but it's hard to tell without seeing how your data is organized and your plugin code and what it's doing. – Brad Bell Sep 25 '14 at 14:36
  • I tried caching the data to reduce the overhead but it was causing issues - you advised me that caching was never designed to be used inside the control panel :) – darylknight Sep 25 '14 at 15:04
  • The {% cache %} tag wasn't, but there are other ways of caching – Brad Bell Sep 25 '14 at 15:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.