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

Reduce memory consumption of collectors #131

Merged
merged 1 commit into from
Sep 16, 2024
Merged

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Sep 16, 2024

a collector should either return a valid result or null - because the returned value is persisted in PHPStan result cache (except for null). therefore you should not return things like [], as this would get serialized per AST node your collector works on.

thats something I learned today and in one of our projects it lead to out-of-memory fatal errors.

for in-detail context see phpstan/phpstan#11701 (comment)

@staabm staabm marked this pull request as ready for review September 16, 2024 15:44
@TomasVotruba TomasVotruba merged commit c82b690 into TomasVotruba:main Sep 16, 2024
8 checks passed
@TomasVotruba
Copy link
Owner

LGTM 👍

@staabm staabm deleted the mem branch September 16, 2024 20:37
neoighodaro added a commit to neoighodaro/unused-public that referenced this pull request Nov 21, 2024
* TomasVotruba-main: (21 commits)
  Delete .github/FUNDING.yml
  Update FUNDING.yml
  Update composer.json
  Keep the code DRY
  Small improvement
  Added support for @internal or @public
  Reduce memory consumption of collectors (TomasVotruba#131)
  Fix blade regex to discover method call with args (TomasVotruba#128)
  Fix template discovery, to include root file too (TomasVotruba#127)
  remove `composer-dependency-analyser.php` from releases (TomasVotruba#126)
  Bump deps (TomasVotruba#125)
  Detect public properties used via Subclass (TomasVotruba#123)
  Fix ClassConstFetchCollector (TomasVotruba#122)
  Fix union-type handling in PublicStaticPropertyFetchCollector (TomasVotruba#121)
  Fix union-type handling in PublicPropertyFetchCollector (TomasVotruba#120)
  add phpstan error identifiers (TomasVotruba#118)
  Fixed nette/utils indirect dependency (TomasVotruba#116)
  Added test for JsonSerialize (TomasVotruba#112)
  Add RelativeUnusedPublicClassMethodRule (TomasVotruba#111)
  Bump to PHP 8.2 (TomasVotruba#110)
  ...
neoighodaro added a commit to neoighodaro/unused-public that referenced this pull request Nov 21, 2024
* origin/main: (22 commits)
  Allow phpstan 2
  Delete .github/FUNDING.yml
  Update FUNDING.yml
  Update composer.json
  Keep the code DRY
  Small improvement
  Added support for @internal or @public
  Reduce memory consumption of collectors (TomasVotruba#131)
  Fix blade regex to discover method call with args (TomasVotruba#128)
  Fix template discovery, to include root file too (TomasVotruba#127)
  remove `composer-dependency-analyser.php` from releases (TomasVotruba#126)
  Bump deps (TomasVotruba#125)
  Detect public properties used via Subclass (TomasVotruba#123)
  Fix ClassConstFetchCollector (TomasVotruba#122)
  Fix union-type handling in PublicStaticPropertyFetchCollector (TomasVotruba#121)
  Fix union-type handling in PublicPropertyFetchCollector (TomasVotruba#120)
  add phpstan error identifiers (TomasVotruba#118)
  Fixed nette/utils indirect dependency (TomasVotruba#116)
  Added test for JsonSerialize (TomasVotruba#112)
  Add RelativeUnusedPublicClassMethodRule (TomasVotruba#111)
  ...
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

Successfully merging this pull request may close these issues.

2 participants