S
S
Sergey2016-02-13 12:59:17
PHP
Sergey, 2016-02-13 12:59:17

How to get around mmap() failed: [12] Cannot allocate memory?

When trying to write a large amount of data to the DBMS, the error mmap() failed: [12] Cannot allocate memory?
The script is executed through php (nginx). DBMS - mysql.
Launched via terminal.
To execute the script, I use the Symfony2.8 framework
. Error:

mmap() failed: [12] Cannot allocate memory

mmap() failed: [12] Cannot allocate memory
PHP Fatal error:  Out of memory (allocated 3083886592) (tried to allocate 25165832 bytes) in /server/www/erohost.dev/www/vendor/symfony/symfony/src/Symfony/Component/Stopwatch/StopwatchEvent.php on line 102
[2016-02-13 12:37:13] php.CRITICAL: Fatal Error: Out of memory (allocated 3083886592) (tried to allocate 25165832 bytes) {"type":1,"file":"/server/www/erohost.dev/www/vendor/symfony/symfony/src/Symfony/Component/Stopwatch/StopwatchEvent.php","line":102,"level":-1,"stack":[]} 


                                                                                  
  [Symfony\Component\Debug\Exception\OutOfMemoryException]                        
  Error: Out of memory (allocated 3083886592) (tried to allocate 25165832 bytes)

How can this problem be solved ?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman Mirilaczvili, 2016-02-13
@karmis

You can write "page by page", say, in portions of 1000 records, wrapping the request in a transaction.
The number of records in a "page" can be determined empirically, based on the amount of available memory.

Y
Yuri Chudnovsky, 2016-02-13
@Frankenstine

PHP Fatal error: Out of memory

Sorry, but the puff was out of memory :) Increase the memory limit in php.ini

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question