[theme-reviewers] PHP Memory Limits?

Dion Hulse (dd32) wordpress at dd32.id.au
Tue Mar 20 00:41:38 UTC 2012


On 20 March 2012 11:25, Bruce Wampler <weavertheme at gmail.com> wrote:
> Dion Hulse wrote:
>
>> Unfortunately, out of memory issues can't be caught from within PHP.
>>
>> WordPress does attempt to increase the default memory limit to 32M for
>> single sites, and 64M for multisite (I believe), while more intensive
>> things such as upgrades and image manipulation increases it to 256M.
>
> Thanks - I feared as much.
>
> Seems there are two problems here - the default WP_MEMORY_LIMIT
> of 32MB, which seems should be increased for 3.4, and stingy shared
> hosts that set a physical limit of 32MB.
>
> I will propose increasing the WP 32MB limit elsewhere, but theme
> related: Would it be appropriate for a theme that knows it has issues
> at 32MB to try to bump the memory limit itself, or is that really out
> of the scope of what a theme should be doing?

I honestly think it's outside of what a theme should be doing, unless,
it's doing complex image manipulations in which case, it should
attempt to set the memory to WP_MAX_MEMORY_LIMIT (although, in most
cases it should be using the image API's which do that automatically)

Many hosts don't even allow PHP to alter it's memory limit as well.

If a theme itself is causing high memory consumption, I'd look into
lazy loading data, that is, only loading it when needed (This applies
to classes/objects/files used as well as data from the Database). but
before blaming the theme, check the memory consumption with TwentyTen
and then with the theme in question. The Debug Bar plugin has the
memory usage details displayed as well.


More information about the theme-reviewers mailing list