Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mmap() failed: [12] Cannot allocate memory #6

Closed
lareck opened this issue Feb 27, 2018 · 3 comments
Closed

mmap() failed: [12] Cannot allocate memory #6

lareck opened this issue Feb 27, 2018 · 3 comments

Comments

@lareck
Copy link

lareck commented Feb 27, 2018

Running, "php artisan geonames:install" on a homestead installations eventually runs out of memory. PHP memory usage increases until all available memory is consumed. Not sure is this a system configuration issue or an issue with the alternate names command.

Split file #289 of 2583 has 5000 rows.
Inserting alternate names 1359/5000 [▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░░]  27%

mmap() failed: [12] Cannot allocate memory

mmap() failed: [12] Cannot allocate memory
PHP Fatal error:  Out of memory (allocated 4495486976) (tried to allocate 16384 bytes) in /vagrant/dr-services/vendor/laravel/framework/src/Illuminate/Database/Connection.php on line 330

mmap() failed: [12] Cannot allocate memory

mmap() failed: [12] Cannot allocate memory
PHP Fatal error:  Out of memory (allocated 4495486976) (tried to allocate 65536 bytes) in /vagrant/dr-services/vendor/laravel/framework/src/Illuminate/Auth/SessionGuard.php on line 18

@michaeldrennen
Copy link
Owner

Looks like the split files are too big for your Homestead set up.

Look inside:
https://github.com/michaeldrennen/Geonames/blob/master/src/Console/AlternateName.php

I set the lines per split file as a constant at the top of that file.

Run a test on your Homestead install where you manually edit that const value before you run the install command.

Lower it to 1000 for starters.

If that solves your problem, then I can add lines per split file as an option for the install command.

@tpelham42
Copy link

I was experiencing a similar issue using WampServer during the alternate names import. The culprit was "DB::enableQueryLog();" on line 389 of the AlternateNames.php file mentioned above. The query logging was generating memory for each record created until it reached critical failure. Commenting out/removing line 389 fixed the issue.

@michaeldrennen
Copy link
Owner

@tpelham42 Bingo. I'll remove that in the next release.

michaeldrennen added a commit that referenced this issue May 3, 2018
They were causing the system to run out of memory.
#6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants