I am trying to run some seeders on a local MariaDB database (on a Mac). memory_limit for PHP is set to 256M. When running the seeder, I get this error message:
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in Unknown on line 0
I tried commenting out all of the code in my seeder's run method just to see if it would continue throwing the error - it did.
Do you guys have any ideas what might be causing this?
How many queries are you executing in total? You might try disabling the query logging, which can use a lot of memory especially during processes where tons of queries are being generated.
DB::disableQueryLog();
// run your other queries...
@Cronix The seeder is running 3 writes (creating 3 users with just a name, email and password). I'll disable logging and see if anything changes, but it seems a bit odd either way for just 3 small queries haha.
I have another Laravel project running in the same environment (I believe it's Laravel 5.5), and it's able to seed a lot more data without any issues.
Think it could be a bug in a recent update to 5.6?
Update: Tried disabling query logging with no luck - still getting the same error.
I don't know if it's a bug. I'm not using laravel 5.6 yet. I just know when I was running tens of thousands (yes) of queries in a long running job pulling a lot of data from an api, I could see the memory usage grow and grow on each pass until it exceeded the memory. When I disabled query logging, it consumed no more than 6M in total even after running for hours. Yeah it won't do much, if anything, on just a few queries.
You'd probably need to post your code to be able to figure out what's going on.
There's not a whole lot to see yet haha. And I haven't messed with my user model a whole lot (aka, there wouldn't be anything out of the norm that would cause problems when creating users).
Here we go:
// DatabaseSeeder.php
public function run()
{
$this->run(UserSeeder::class);
$this->run(PolicySeeder::class);
}
It never makes it past the UserSeeder, even when I comment out all of the code in the "run" method.
Tried doing the same for PolicySeeder, same result.