skip to Main Content

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 MagentoFrameworkDataObject $entity
 * @return void
 * @SuppressWarnings(PHPMD.UnusedLocalVariable)
 */
public function registerSnapshot(MagentoFrameworkDataObject $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

how to resolve this issue

3

Answers


  1. Chosen as BEST ANSWER

    @Kashif answer help me a lot.

    But none of the options not worked for me.

    Problem solved.

    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.


  2. Try this
    Allowed memory size of 792723456 bytes exhausted (tried to allocate 184320 bytes)
    https://magento.stackexchange.com/a/209993/49715

    Login or Signup to reply.
  3. php bin/magento setup:upgrade
    php bin/magento setup:static-content:deploy
    php bin/magento setup:di:compile
    php bin/magento cache:flush
    php bin/magento cache:clean
    
    //To run command forcefully
    php -f bin/magento
    
    //To run command with memory limit 4G
    php -d memory_limit=4G bin/magento
    
    //To run command with max memory limit
    php -d memory_limit=-1 bin/magento
    
    ini_set('memory_limit',256);
    

    OR

    ini_set('memory_limit','-1');
    

    follow full link here
    https://magento.stackexchange.com/questions/209976/magento-2-2-2-allowed-memory-size-of-792723456-bytes-exhausted-tried-to-alloc/209993#209993

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search