-
-
Notifications
You must be signed in to change notification settings - Fork 500
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
Fatal error: Out of memory (allocated 46137344) (tried to allocate 20480 bytes) #202
Comments
Fatal error: Out of memory (allocated 767557632) (tried to allocate 262144 bytes) in D:\xampp\htdocs\LearningGPS\vendor\ramsey\uuid\src\Builder\DegradedUuidBuilder.php on line 51 |
Most likely you have too much memory allocated elsewhere, and this is just where your program crashes. It's unlikely that uuid is the issue here. |
Is the script that's running when you see this error using a lot of memory for some other processes before it gets to this point? |
Your code contains an infinite loop. You are calling |
@kaphert Since it's a static method, should it be |
This issue is not related to the uuid library. The code should be: public static function create($data) {
try {
$uuid4 = Uuid::uuid4();
return parent::create([
'uuid' => $uuid4->toString(),
'name' => isset($data['name']) ? $data['name'] : '',
'email' => isset($data['email']) ? $data['email'] : throwException("Email Is Required!"),
'password' => isset($data['password']) ? $data['password'] : throwException("Password is Required!")
]);
} catch (\Exception $e) {
//Log::error($e->getTrace());
return $e->getTrace();
}
} This is part of a Laravel Eloquent model. I would not recommend doing value checks and assign UUID like this but that is another issue. It would be better to listen for events like public static function boot()
{
parent::boot();
self::creating(function ($model) {
if (!$model->uuid) {
$model->uuid = Uuid::uuid4()->toString();
}
});
} |
Fatal error: Out of memory (allocated 46137344) (tried to allocate 20480 bytes) in D:\xampp\htdocs\XXXXXX\vendor\ramsey\uuid\src\Codec\StringCodec.php on line 57
``
class UserModel extends Model {
``
Not sure Where is the mistake.
The text was updated successfully, but these errors were encountered: