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

Increased memory usage for PHPUnit #216

Closed
mikey179 opened this issue Feb 19, 2020 · 1 comment
Closed

Increased memory usage for PHPUnit #216

mikey179 opened this issue Feb 19, 2020 · 1 comment
Assignees
Labels

Comments

@mikey179
Copy link
Member

I just noted that since merging #212 memory usage for running PHPUnit has increased from around 20 MB per run to ~1GB per run (fluctuating between several 100 MB and 2 GB), both with coverage enabled. Disabling coverage doesn't make any difference. I don't know where this comes from but this should definitely be investigated.

@mikey179
Copy link
Member Author

mikey179 commented Feb 19, 2020

Found it: the problem is the usage of fread($fh, rand()); in vfsStreamWrapperErroneousFileTestCase where rand() often produces large numbers for which PHP has to allocate memory - PHP doesn't know yet that the read will fail and it actually doesn't need that much memory, but it has to allocate beforehand. That also explains why memory usage is fluctuating that much.

@mikey179 mikey179 added bug and removed investigate labels Feb 19, 2020
@mikey179 mikey179 self-assigned this Feb 19, 2020
bizurkur added a commit that referenced this issue Feb 20, 2020
Limit maximum amount of bytes to read, fixes #216
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant