Phpinsights: Suggestion to fix "If you encounter the error Allowed memory size of XXXXX bytes exhausted" error

Created on 16 May 2019  路  16Comments  路  Source: nunomaduro/phpinsights

If you encounter the error Allowed memory size of XXXXX bytes exhausted, the current workaround is to increase the memory limit:

While reading the docs, I saw this statement and it was something I ran into pretty quickly when adding insights my projects.

I'm only making a suggestion as I have not had the time to make a clone of the repo to see if it is possible. But, I was thinking, this might be a good use for PHP Generators. They make memory management in PHP tolerable when dealing with large data.

enhancement help wanted

All 16 comments

Maybe. For the moment we have this: https://phpinsights.com/get-started.html#allowed-memory-size-of-x-bytes-exhausted.

@nunomaduro I am facing this issue inside a docker (dev without memory limit).

Screenshot 2020-04-02 at 15 56 07

Seems to be arround the 2 GB (default memory for docker) minus whatever you are running on that docker.
Can you try adding more memory to Docker Engine to see if it solves it?

Well, I did it also in my local machine mac pro with 16Gb ram and same problem... Also as I said PHP (local machine) has memory_limit = -1

However, I'll see those configurations with more precision.

After 13 secs stops... I'm using ide-helper and the error is almost the same:

/var/www/vendor/nunomaduro/phpinsights/src/Domain/Insights/SniffDecorator.php on line 65

92/592 [鈻撯枔鈻撯枔鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒] 15% 13 secs

  • app/Models/CorpRequest.php%

I meant this,
image

@sierrafayad I have tested also in my local machine without docker ... I have 16Gb memory is mac pro, lock at my last post.

@apoca Did you allowed extra memory to insights? https://phpinsights.com/get-started.html#allowed-memory-size-of-x-bytes-exhausted

As I said (memory_limit = -1):

php -d memory_limit=160000M ./vendor/bin/phpinsights -v

123/592 [鈻撯枔鈻撯枔鈻撯枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒] 20% 23 secs

  • app/Models/CorpCompanyEmployee.php%

error_log:

[02-Apr-2020 17:32:28 UTC] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 1003520 bytes) in /Applications/MAMP/htdocs/esolidar-api/vendor/nunomaduro/phpinsights/src/Domain/Insights/SniffDecorator.php on line 65

If you run php -i -d memory_limit=160000M | grep memory_limit does it gives you the correct amount? or 128M

gives me... as expected memory_limit => -1 => -1

Well idk 馃槄 hahaha.
Is there any possibility of some memory_limit being set somewhere in the code?
I'm out of options.

Then, before I came here I did a lot of testes I have tried almost every thing and I got without solutions... This happened before with other stuff and I have fixed as you guys said in docs... Therefore, I am also without ideas :/

@sierrafayad Currently we don't touch memory limit in the code.

@kayandra I like the idea of trying to use generators in more places. Might help us save some memory around the system.

@olivernybroe, yes I agree with you and it might that is happening with other developers and they prefer to uninstall the package. I suggest that this bug must be open.

@apoca I think it makes more sense to create an issue which is for adding generators. Adding generators does not fix memory size, it just reduced the likability of it happening.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dmitryuk picture dmitryuk  路  5Comments

michaelnguyen547 picture michaelnguyen547  路  6Comments

calvinchiulele picture calvinchiulele  路  5Comments

nunomaduro picture nunomaduro  路  5Comments

viezel picture viezel  路  4Comments