title: Composer Require Out of Memory
body: <p>So, I've poured through the stack and git bug threads on this and can't seem to find anything that helps. This is a dev server, centos linux, running php 7.2, roughly 12Gb of available RAM and swap.</p>
  
  <p>Running out of memory on composer require or composer update.</p>
  
  <p>I have set memory usage to -1, and verified that the CLI version of php is set to -1. </p>
  
  <pre><code>php -i | grep memory
  memory_limit =&gt; -1 =&gt; -1
  </code></pre>
  
  <p>I have run: composer self-update, and it is at the most recent version.</p>
  
  <p>I have tried running via: <code>php -d memory_limit=-1 composer require ...</code></p>
  
  <p>And, in every instance, it is still running out of memory just trying to use require. Is there somewhere composer is overriding my limits set in php.ini or runtime setting. It appears to maxing out at around 200Mb.</p>
  
  <p>Updating:</p>
  
  <pre><code>php -v
  ea-php-cli Copyright 2017 cPanel, Inc.
  PHP 7.0.28 (cli) (built: Mar  6 2018 09:28:15) ( NTS )
  Copyright (c) 1997-2017 The PHP Group
  Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
  </code></pre>
  
  <p>Output of composer -vvv requre:</p>
  
  <pre><code>$ composer -vvv require willdurand/jsonp-callback-validator
  Reading ./composer.json
  Loading config file ./composer.json
  Checked CA file /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem: valid
  Executing command (/home/XXXXXXXX/gateway): git branch --no-color --no-abbrev -v
  Failed to initialize global composer: Composer could not find the config file: /home/XXXXXXXX/.config/composer/composer.json
  To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
  Reading /home/XXXXXXXX/gateway/vendor/composer/installed.json
  Loading plugin PackageVersions\Installer
  Running 1.6.3 (2018-01-31 16:28:17) with PHP 7.0.28 on Linux / 4.15.12-x86_64-linode105
  Downloading https://packagist.org/packages.json
  Writing /home/XXXXXXXX/.cache/composer/repo/https---packagist.org/packages.json into cache
  Reading /home/XXXXXXXX/.cache/composer/repo/https---packagist.org/p-provider-2013.json from cache
  Reading /home/XXXXXXXX/.cache/composer/repo/https---packagist.org/p-provider-2014.json from cache
  Reading /home/XXXXXXXX/.cache/composer/repo/https---packagist.org/p-provider-2015.json from cache
  Reading /home/XXXXXXXX/.cache/composer/repo/https---packagist.org/p-provider-2016.json from cache
  Reading /home/XXXXXXXX/.cache/composer/repo/https---packagist.org/p-provider-2017.json from cache
  Reading /home/XXXXXXXX/.cache/composer/repo/https---packagist.org/p-provider-2017-04.json from cache
  Reading /home/XXXXXXXX/.cache/composer/repo/https---packagist.org/p-provider-2017-07.json from cache
  Reading /home/XXXXXXXX/.cache/composer/repo/https---packagist.org/p-provider-2017-10.json from cache
  Reading /home/XXXXXXXX/.cache/composer/repo/https---packagist.org/p-provider-2018-01.json from cache
  Reading /home/XXXXXXXX/.cache/composer/repo/https---packagist.org/p-provider-archived.json from cache
  Reading /home/XXXXXXXX/.cache/composer/repo/https---packagist.org/p-provider-latest.json from cache
  Reading /home/XXXXXXXX/.cache/composer/repo/https---packagist.org/provider-willdurand$jsonp-callback-validator.json from cache
  Using version ^1.1 for willdurand/jsonp-callback-validator
  ./composer.json has been updated
  Reading ./composer.json
  Loading config file ./composer.json
  Executing command (/home/XXXXXXXX/gateway): git branch --no-color --no-abbrev -v
  Failed to initialize global composer: Composer could not find the config file: /home/XXXXXXXX/.config/composer/composer.json
  To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
  Reading /home/XXXXXXXX/gateway/vendor/composer/installed.json
  Loading plugin PackageVersions\Installer_composer_tmp0
  Reading ./composer.lock
  Loading composer repositories with package information
  Downloading https://packagist.org/packages.json
  Writing /home/XXXXXXXX/.cache/composer/repo/https---packagist.org/packages.json into cache
  Updating dependencies (including require-dev)
  Reading /home/XXXXXXXX/.cache/composer/repo/https---packagist.org/p-provider-2013.json from cache
  Reading /home/XXXXXXXX/.cache/composer/repo/https---packagist.org/p-provider-2014.json from cache
  Reading /home/XXXXXXXX/.cache/composer/repo/https---packagist.org/p-provider-2015.json from cache
  Reading /home/XXXXXXXX/.cache/composer/repo/https---packagist.org/p-provider-2016.json from cache
  Reading /home/XXXXXXXX/.cache/composer/repo/https---packagist.org/p-provider-2017.json from cache
  Reading /home/XXXXXXXX/.cache/composer/repo/https---packagist.org/p-provider-2017-04.json from cache
  Reading /home/XXXXXXXX/.cache/composer/repo/https---packagist.org/p-provider-2017-07.json from cache
  
  mmap() failed: [12] Cannot allocate memory
  
  mmap() failed: [12] Cannot allocate memory
  
  Fatal error: Out of memory (allocated 196608000) (tried to allocate 20480 bytes) in phar:///opt/cpanel/composer/bin/composer/src/Composer/Repository/ComposerRepository.php on line 574
  
  mmap() failed: [12] Cannot allocate memory
  
  Fatal error: Out of memory (allocated 196608000) (tried to allocate 20480 bytes) in phar:///opt/cpanel/composer/bin/composer/src/Composer/Console/Application.php on line 78
  </code></pre>