0

I got this issue when creating the customer in magneto 2.

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes) in /vendor/magento/framework/Model/ResourceModel/Db/VersionControl/Snapshot.php on line 47

due to this reason, I increased the memory limit up to 8 GB. but the issue remains.

/**
 * Register snapshot of entity data, for tracking changes
 *
 * @param \Magento\Framework\DataObject $entity
 * @return void
 * @SuppressWarnings(PHPMD.UnusedLocalVariable)
 */
public function registerSnapshot(\Magento\Framework\DataObject $entity)
{
    $metaData = $this->metadata->getFields($entity);
    $filteredData = array_intersect_key($entity->getData(), $metaData);
    $data = array_merge($metaData, $filteredData);
    $this->snapshotData[get_class($entity)][$entity->getId()] = $data;
}

issue raised in this line $data = array_merge($metaData, $filteredData);

vendor/magento/framework/Model/ResourceModel/Db/VersionControl/Snapshot.php

What solution we need to provide this.

5
  • where you are getting this issue are you doing any custom code?
    – Waqar Ali
    Commented May 24, 2021 at 7:20
  • /vendor/magento/framework/Model/ResourceModel/Db/VersionControl/Snapshot.php on line 47
    – Singhe
    Commented May 24, 2021 at 7:32
  • @WaqarAli 'customer/account/createpost/'
    – Singhe
    Commented May 24, 2021 at 11:19
  • this error usually occurs when you use getData() method on Model Object please check is this any case in Your Custom Code
    – Waqar Ali
    Commented May 24, 2021 at 11:21
  • hi @WaqarAli I updated question with code which is error occured. could you check it?
    – Singhe
    Commented May 25, 2021 at 11:26

1 Answer 1

0

This may be worked.

Magento 2.2.2 : Allowed memory size of 792723456 bytes exhausted (tried to allocate 184320 bytes)

But none of the above options not worked for me.

My server is nginx. It memory limit defined in /etc/nginx/magento.conf

open the file and search

fastcgi_param  PHP_VALUE "memory_limit=

inside the below block

location ~ (index|get|static|report|404|503|info|cleanopcache)\.php$ {

}

after found that line, the memory limit has to set as 6144M

fastcgi_param PHP_VALUE "memory_limit=6144M \n max_execution_time=600";

after that, it works fine.

you able to find how much memory limit set in your Magento projects via debug log.

make log with ini_get('memory_limit');

hope this helps you all.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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