Solution for : VirtualAlloc() failed: [0x00000008] Not enough storage is available to process this command in magento2

We may have a chance to get some of the error message (below) while running/install the sample Data or running a static content deploy or compile using command line.

In my scenario, i got these error message while running “php bin/magento sampledata:deploy” command using terminal in windows machine (xampp).

Error Messages:

Command : php bin/magento sampledata:deploy
Description : When i use the above command line in terminal, I got the below error message . Than i try to execute the same command with set memorylimit.
Issue :1

Allowed memory size of 792723456 bytes exhausted (tried to allocate 4096 bytes)

Issue : 2

VirtualAlloc() failed: [0x00000008] Not enough storage is available to process this command.

Command : php -dmemory_limit=10G bin/magento sampledata:deploy
Description : Still am not able to complete to install sample data due to below error message.

VirtualAlloc() failed: [0x00000008] Not enough storage is available to process this command.
VirtualFree() failed: [0x000001e7] Attempt to access invalid address.
VirtualAlloc() failed: [0x00000008] Not enough storage is available to process this command.
VirtualFree() failed: [0x000001e7] Attempt to access invalid address.
PHP Fatal error: Out of memory (allocated 1023410176) (tried to allocate 4096 bytes) vendor\composer\composer\src\Composer\DependencyResolver\RuleWatchGraph.php on line 52
Fatal error: Out of memory (allocated 1023410176) (tried to allocate 4096 bytes) in vendor\composer\composer\src\Composer\DependencyResolver\RuleWatchGraph.php on line 52
Your project may not be setup on the appropriate architecture.

Solution :

  1. First verify you PHP is 32bit or 64bit using print_r(PHP_INT_SIZE).
    If you PHP is 32bit than you can not able to use more than 2GB on command line. Even if you have 16GB of RAM in your machine.(Because of Xampp environment )
  2. To resolve this issue set memory limit -1 in php.ini file.
    Sample : Open ini file and modify as like below
    ; Maximum amount of memory a script may consume (128MB)
    ; http://php.net/memory-limit
    memory_limit=-1
  3. This solution is suggested only for you local machine setup, not suggested for production environment.

Save Water!!! Every drop counts!!!