Skip to content

Upgrade Dead Code Detector to 0.15.x#5160

Closed
staabm wants to merge 2 commits intophpstan:2.1.xfrom
staabm:pr/5135
Closed

Upgrade Dead Code Detector to 0.15.x#5160
staabm wants to merge 2 commits intophpstan:2.1.xfrom
staabm:pr/5135

Conversation

@staabm
Copy link
Copy Markdown
Contributor

@staabm staabm commented Mar 9, 2026

#5135 but with conflicts resolved

@staabm staabm requested a review from VincentLanglet March 9, 2026 11:12
@staabm staabm changed the title Upgrade Dead Code Detector to 0.15 Upgrade Dead Code Detector to 0.15.x Mar 9, 2026
@staabm
Copy link
Copy Markdown
Contributor Author

staabm commented Mar 9, 2026

@janedbal fyi, it seem the new version requires more memory than the old one.

a job which worked on 0.14.x now runs into a memory limit:
https://github.com/phpstan/phpstan-src/actions/runs/22850713236/job/66278297491?pr=5160

@VincentLanglet VincentLanglet self-requested a review March 9, 2026 11:30
@ondrejmirtes
Copy link
Copy Markdown
Member

We have planned improvements to the result cache which should help. I'd rather soon do the improvements and then upgrade this package.

@janedbal
Copy link
Copy Markdown
Contributor

janedbal commented Mar 9, 2026

I analysed this on friday. See shipmonk-rnd/dead-code-detector#310. Using --memory-limit is pretty bad way how to keep memory in shape. PHPStan limits memory per process, which limits how much work can DCD do here. But the peak of consumed memory by PHPStan is the sum of worker processes near their exit:

image

And that is FAR beyond what DCD takes (becase that runs when child processes are long dead). So I'd say it is ok for collector-based rules to take MUCH more memory (below that sum) as it does not increase overall memory consumption which you typically care about (CI limits). But thanks to --memory-limit, I cannot.


Also, regular projects are not affected by DCD memory at all (not even when you look at the main process, e.g. ShipMonk codebase main process takes about 4GB and DCD is only about 800 MB of that) - phpstan-src is an exception for some reason.


Also, I can "fix" memory consumtion here in PHPStan by omitting that cache, but it makes no sense in real world. I can also make it configurable for you, but again - it makes no sense imo.

@staabm
Copy link
Copy Markdown
Contributor Author

staabm commented Mar 9, 2026

thanks everyone.

lets revisit after phpstan/phpstan#14074 was resolved

@staabm staabm closed this Mar 9, 2026
@staabm staabm deleted the pr/5135 branch March 9, 2026 13:04
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.

4 participants