This smart wordpress code would be useful to Drupal:
if ( !defined('WP_MEMORY_LIMIT') )
define('WP_MEMORY_LIMIT', '32M');
if ( function_exists('memory_get_usage') && ( (int) @ini_get('memory_limit') < abs(intval(WP_MEMORY_LIMIT)) ) )
@ini_set('memory_limit', WP_MEMORY_LIMIT);
If it isn't set, it sets it to 32M. If it is set, it checks to see if the current usage (limit) is greater than 32 (in which case it leaves things alone). I'm not sure why they call function_exists('memory_get_usage'): http://de.php.net/manual/en/function.memory-get-usage.php
Comments
Comment #1
karschsp commentedtagging for the novice queue.
Comment #2
dave reidBetter solution for Drupal is to allow modules to define a memory requirement. Add all the requirements and make a total requirement. See #309457: Allow profiles to specify required memory in .info file.