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

Huge memory consumption on dev branch #3797

Closed
orklah opened this issue Jul 10, 2020 · 9 comments
Closed

Huge memory consumption on dev branch #3797

orklah opened this issue Jul 10, 2020 · 9 comments

Comments

@orklah
Copy link
Collaborator

orklah commented Jul 10, 2020

I just updated Psalm to the last dev version today and Psalm doesn't run anymore with the 8Gb memory it has.

The error is
PHP Fatal error: Allowed memory size of 8589934592 bytes exhausted (tried to allocate 1912606720 bytes) in C:\Users\rmorin\Documents\PhpstormProjects\vendor\vimeo\psalm\src\Psalm\Internal\Analyzer\Statements\Expression\AssertionFinder.php on line 144

This seems related to the fix for #3631

@psalm-github-bot
Copy link

Hey @orklah, can you reproduce the issue on https://psalm.dev ?

@muglug
Copy link
Collaborator

muglug commented Jul 10, 2020

Can you narrow this down to an individual file by running with --debug?

@orklah
Copy link
Collaborator Author

orklah commented Jul 10, 2020

Can you narrow this down to an individual file by running with --debug?

I did, The file is around 1700 lines but I nothing really particular for our codebase. I tried running only this file and it fails too (with a failed allocation of 2.8G).
Anything specific I should look for? What does this code do? I tried putting the file on psalm.dev but it fails because it's too big(I think). If I remove some comments, it shows error due to missing dependancies

@muglug
Copy link
Collaborator

muglug commented Jul 10, 2020

Anything specific I should look for?

Yeah, try removing stuff (methods and/or method bodies) from the file until it doesn't fail anymore

@orklah
Copy link
Collaborator Author

orklah commented Jul 10, 2020

Somehow, it's caused by a big ball of chained assignations:

                $operateur_reno = $batiment_reno = $operateur_condi = $operateur_qualite = $batiment_qualite =
                $operateur_mad = $batiment_mad = $date_expe = $heure_expe = $operateur_expe = $batiment_expe =
                $operateur_retrofit = $batiment_retrofit = $resultat_retrofit = $operateur_soft = $batiment_soft =
                $operateur_pretest = $batiment_pretest = $resultat_pretest = $operateur_foudre = $batiment_foudre =
                $resultat_foudre = $operateur_dielec = $batiment_dielec = $resultat_dielec = $batiment_condi =
                $code_panne = $etape_panne = $code_panne = $operateur_saisie = $batiment_saisie =
                $accessoires_saisis = $aspect_saisie = $rejet_garantie = $type_depannage_transfert =
                $sn_saisie = $sn_cosmetic = '';

When I remove this, it's ok, when it's back, the analysis takes a long time and fails with memory issue

@orklah
Copy link
Collaborator Author

orklah commented Jul 10, 2020

I reproduce with a smaller chain:

                $code_defaut_signale = $defaut_signale = $code_defaut_signale_cli = $defaut_signale_cli =
                $operateur_reno = $batiment_reno = $operateur_condi = $operateur_qualite = $batiment_qualite =
                $operateur_mad = $batiment_mad = $date_expe = $heure_expe = $operateur_expe = $batiment_expe =
                $operateur_retrofit = $batiment_retrofit = $resultat_retrofit = $operateur_soft = $batiment_soft =
                $operateur_pretest = $batiment_pretest = $resultat_pretest = $operateur_foudre = $batiment_foudre =
                $resultat_foudre = $operateur_dielec = $batiment_dielec = $resultat_dielec = '';

But after that, when I try to remove one of the variables, it seems to suddenly work (I tried removing 2-3 different variable to see if it was a specific variable that caused it, but it doesn't seem so)

@weirdan
Copy link
Collaborator

weirdan commented Jul 10, 2020

Reproducible on psalm.dev: https://psalm.dev/r/b909e38485

@muglug
Copy link
Collaborator

muglug commented Jul 10, 2020

Oh well that's obvious, Psalm can't read French.

@muglug muglug closed this as completed in 8d02230 Jul 10, 2020
@orklah
Copy link
Collaborator Author

orklah commented Jul 10, 2020

Thanks!

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

3 participants