Hello,
We have developed some front end triggered admin cache cleaning and rebuilding utilities that require a large increase in memory (1G). These utilities are only triggered by admins and the memory is only increased when admin clicks the button so it is not a performance issue.
Our memory increase was not taking place as expected and we realized that the Econa plugin is forcing the memory_limit to 512M without regard for whether this is an increase of memory or not.
I could not find online examples for best practices to increase memory without risk of decreasing it but the snippet below should work to replace your
I left multiples of 1024 just for clarity for kilobyte, megabyte and gigabyte values.
please let us know if this can be rolled into the next release so we do not need to maintain a patch.
Thank you
We have developed some front end triggered admin cache cleaning and rebuilding utilities that require a large increase in memory (1G). These utilities are only triggered by admins and the memory is only increased when admin clicks the button so it is not a performance issue.
Our memory increase was not taking place as expected and we realized that the Econa plugin is forcing the memory_limit to 512M without regard for whether this is an increase of memory or not.
I could not find online examples for best practices to increase memory without risk of decreasing it but the snippet below should work to replace your
ini_set('memory_limit', '512M');call with a check for existing value.
$memory_limit = ini_get('memory_limit'); $memory_num = preg_replace('#^(\d+).*#', '$1', $memory_limit); if (str_contains($memory_limit, 'K')) { $memory_num *= 1024; } if (str_contains($memory_limit, 'M')) { $memory_num *= 1024 * 1024; } if (str_contains($memory_limit, 'G')) { $memory_num *= 1024 * 1024 * 1024; } if ($memory_num < (512 * 1024 * 1024)) { ini_set('memory_limit', '512M'); }
I left multiples of 1024 just for clarity for kilobyte, megabyte and gigabyte values.
please let us know if this can be rolled into the next release so we do not need to maintain a patch.
Thank you