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

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

Closed
kayandra opened this issue May 16, 2019 · 17 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@kayandra
Copy link

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.

@nunomaduro nunomaduro added enhancement New feature or request help wanted Extra attention is needed labels May 16, 2019
@nunomaduro
Copy link
Owner

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

@apoca
Copy link

apoca commented Apr 2, 2020

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

Screenshot 2020-04-02 at 15 56 07

@franksierra
Copy link
Contributor

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?

@apoca
Copy link

apoca commented Apr 2, 2020

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.

@apoca
Copy link

apoca commented Apr 2, 2020

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%

@franksierra
Copy link
Contributor

I meant this,
image

@apoca
Copy link

apoca commented Apr 2, 2020

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

@50bhan
Copy link
Contributor

50bhan commented Apr 2, 2020

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

@apoca
Copy link

apoca commented Apr 2, 2020

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

@franksierra
Copy link
Contributor

franksierra commented Apr 2, 2020

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

@apoca
Copy link

apoca commented Apr 2, 2020

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

@franksierra
Copy link
Contributor

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

@apoca
Copy link

apoca commented Apr 2, 2020

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 :/

@olivernybroe
Copy link
Collaborator

@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.

@apoca
Copy link

apoca commented Apr 3, 2020

@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.

@olivernybroe
Copy link
Collaborator

@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.

@wlarch
Copy link

wlarch commented Jun 8, 2021

My latest comment on this issue can help others :
#63 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

7 participants