1

Hello I am using magmodule rich snippet where this code block add some snippet to catalogue page:

$snip_html = $block->getLayout()
                     ->createBlock('snippets/products')
                     ->setTemplate('magmodules/snippets/widget.phtml')
                     ->toHtml();  

But this is generating error as follow:

Allowed memory size of 805306368 bytes exhausted (tried to allocate 53660871 bytes) in ob_get_clean called at app/code/core/Mage/Core/Block/Template.php (263)

Even if I emptied the 'magmodules/snippets/widget.phtml' then also error persist there but if I do exit at the end of phtml file then there is no error.

So what is the issue here and how to debug this issue.

Thanks

1

Set your memory_limit to be greater than 756MB

memory_limit = 756M

You can check your memory_limit value in your php.ini file or create a PHP file in your Magento root to check the current memory_limit value

<?php
phpinfo();

Please find the memory_limit values recommended by Magento in 2.X

Compiling code or deploying static assets, 756M

Installing and updating Magento components from Magento Marketplace, 2G

Testing, ~3-4G

  • but I want to know the cause that why there is memory exhausted error even if phtml is empty – Stack user May 28 at 9:40
  • Even though PHTML is empty the objects created for classes used in this block class and others related to this will be instantiated which will require memory to instantiate them – Raj Mohan R May 28 at 9:46
  • Ok thanks for the explanation. Please can you also tell is there any alternative to escape this exception if do not want to increase my memory limit. – Stack user May 28 at 10:01
  • It is not possible Magento Recommends the following values for memory limit Compiling code or deploying static assets, 756M Installing and updating Magento components from Magento Marketplace, 2G Testing, ~3-4G – Raj Mohan R May 28 at 10:06
  • but if I want any try catch solution for this or any php approach then is there any way as right now I am unable to increase my live site memory limit so is there any other handling as it is not required to executed above function – Stack user May 28 at 10:09

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.