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

PHP Fatal error: Allowed memory size of XXX bytes exhausted #5

Closed
infectormp opened this issue Sep 26, 2015 · 9 comments
Closed

PHP Fatal error: Allowed memory size of XXX bytes exhausted #5

infectormp opened this issue Sep 26, 2015 · 9 comments

Comments

@infectormp
Copy link

Hello.

When i scan some source at my host i get 2 times PHP Fatal error
at 128MB memory limit:
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 72 bytes) in /xxx/PhpCodeFixer.php on line 63

at 256MB memory limit:
PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 524288 bytes) in /xxx/PhpCodeFixer.php on line 40

after i set memory limit for php to 512MB i not get this errors.

@wapmorgan
Copy link
Owner

  • Do some tests with large php files

@wapmorgan
Copy link
Owner

I'll look if I could add some tweaks to improve memory consumption.

@wapmorgan
Copy link
Owner

Can you tell what script are you checking?

@infectormp
Copy link
Author

i check osTciket master branch https://github.com/osTicket/osTicket-1.8

@infectormp
Copy link
Author

i use php 5.6.13

@wapmorgan
Copy link
Owner

Ok, I've updated phpcf and added option --max-size with default value 1mb. This option sets what file is considered too big and should be skipped. You can use mb, kb and gb suffixes in this option to set another size limit.

For example, you can increase your memory_limit option in php config and then increase file size limit like this:

php bin/phpcf --max-size 1gb ../osTicket

@infectormp, now try to check your script again and write down the results.

@infectormp
Copy link
Author

Work fine. Thank you.

@infectormp
Copy link
Author

877Kb file get out of memory Allowed memory size of 134217728 bytes exhausted (tried to allocate 72 bytes) in /xxx/PhpCodeFixer.php on line 12

maybe need set default size to 512Kb

@infectormp
Copy link
Author

btw, php 7 not have this issue. Peak memory usage: 69.315 MB @ 877 Kb file.

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

2 participants