composer: Cannot update packages anymore "Fatal error: Out of memory (allocated 1392771072) (tried to allocate 268435456 bytes)"

My composer.json:

{
    "name": "gregv/des-iwid",
    "description" : "The Desoutter Industrial Tools multilingual website",
    "license": "proprietary",
    "type": "project",
    "autoload": {
        "psr-4": {
            "": "src/"
        },
        "classmap": [
            "app/AppKernel.php",
            "app/AppCache.php",
            "vendor/phpdocx/Classes/Phpdocx"
        ]
    },
    "require": {
        "cloudconvert/cloudconvert-php": "^2.2",
        "cspoo/swiftmailer-mailgun-bundle": "^0.3.1",
        "doctrine/doctrine-bundle": "~1.4",
        "doctrine/orm": "^2.4.8",
        "egeloen/ckeditor-bundle": "^4.0",
        "fresh/vich-uploader-serialization-bundle": "^1.0",
        "friendsofsymfony/jsrouting-bundle": "^1.6",
        "friendsofsymfony/user-bundle": "~2.0",
        "helios-ag/fm-elfinder-bundle": "^6.2",
        "hshn/base64-encoded-file": "^1.2",
        "incenteev/composer-parameter-handler": "~2.0",
        "jms/di-extra-bundle": "^1.8",
        "jms/i18n-routing-bundle": "^2.0",
        "jms/serializer-bundle": "^2.0",
        "jms/translation-bundle": "^1.3",
        "knplabs/knp-menu-bundle": "^2.0",
        "knpuniversity/oauth2-client-bundle": "^1.16",
        "league/oauth2-linkedin": "^2.1",
        "leaseweb/memcache-bundle": "^2.1",
        "lexik/jwt-authentication-bundle": "^2.4",
        "liip/imagine-bundle": "^1.6",
        "mediafigaro/google-analytics-api-symfony": "^1.0",
        "ninsuo/symfony-collection": "^2.1",
        "php": ">=5.3.9",
        "php-http/guzzle6-adapter": "^1.1",
        "sensio/distribution-bundle": "~5.0",
        "sensio/framework-extra-bundle": "^3.0.2",
        "stof/doctrine-extensions-bundle": "^1.2",
        "symfony/assetic-bundle": "^2.8",
        "symfony/monolog-bundle": "~2.4",
        "symfony/swiftmailer-bundle": "~2.3",
        "symfony/symfony": "2.8.*",
        "twig/extensions": "^1.4",
        "vich/uploader-bundle": "^1.3",
        "willdurand/js-translation-bundle": "^2.6"
    },
    "require-dev": {
        "sensio/generator-bundle": "~3.0",
        "symfony/phpunit-bridge": "~2.7",
        "doctrine/doctrine-fixtures-bundle": "^2.3"
    },
    "scripts": {
        "symfony-scripts": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
        ],
        "post-install-cmd": [
            "@symfony-scripts",
            "Fuz\\Symfony\\Collection\\ScriptHandler::postInstall"
        ],
        "post-update-cmd": [
            "@symfony-scripts",
            "Fuz\\Symfony\\Collection\\ScriptHandler::postUpdate"
        ]
    },
    "config": {
        "bin-dir": "bin",
        "component-dir": "web/assets"
    },
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "symfony-assets-install": "hard",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        }
    }
}

Output of composer diagnose:

Checking composer.json: WARNING
Defining autoload.psr-4 with an empty namespace prefix is a bad idea for performance
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0  87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B  0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: OK
Composer version: 1.6.5
PHP version: 5.6.18
PHP binary path: C:\wamp\bin\php\php5.6.18\php.exe

When I run this command:

php -d memory_limit=-1 composer.phar update -vvv

I get the following output:

Fatal error: Out of memory (allocated 1392771072) (tried to allocate 268435456 bytes) in phar://C:/wamp/www/DES
iwid/composer.phar/src/Composer/DependencyResolver/Solver.php on line 220

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 48 (13 by maintainers)

Commits related to this issue

Most upvoted comments

Did this on my linux box and it worked

sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024 sudo /sbin/mkswap /var/swap.1 sudo /sbin/swapon /var/swap.1

Hi, this solution will fix your problem.

Update your php.ini file then restart Apache or your server example: memory_limit=128M to memory_limit=1128M

It’s work on me.

In case anyone else comes across this and is stuck with a 32 bit version of php on Windows, this patcher worked for me https://ntcore.com/?page_id=371, I applied it to the php.exe and composer updated it no problems at all, memory usage was just a touch over 2GB.

and is stuck with a 32 bit version of php on Windows

Given that all maintained Windows versions out there only have 64-bit versions and switching to a 64-bit build of PHP takes less than 5 minutes - how could you get stuck on a 32-bit version of PHP?

Hi, closing my web-browser and any other memory expensive application fixed this for me. (It required 1.3 GB free RAM which I had to free)

self-update worked for me

As my comment above indicates: that’s not so strange as it implies you were running a developer machine without a swapfile. That’s suicide unless it has at least 16GB of RAM anyway.

I can confirm that eedbd218f52c526ec41c6c623137c3781eb4d928 fixes the issue.

We’ve been hit by this issue as well. But only if we use the latest composer dev version. Composer version: 1016cf19b2c6212b76df5b4f58ba1be8382e5945

php -d memory_limit=-1 composer.phar dump-autoload --no-dev

This uses all the the remaining memory and starts to swap. I can confirm that 22025f2e29dbcae962efaec49e3c8677edde8a6f works ok. But since the merge of #7316 ( b0be87177d62611e0bf22825942be4820e7295c4 ) it starts with the memory eating. 🍪