Skip to content

clear-result-cache runs into out-of-memory when including big baseline #6432

@j-koehler

Description

@j-koehler

Bug report

Running PHPStan 1.4.2 (also occured on 1.3.3, but upgraded to check if it maybe is already fixed):

Running PHPStan through vendor/bin/phpstan clear-result-cache -c phpstan.neon runs into memory problems, when phpstan.neon includes a big baseline.

Code snippet that reproduces the problem

$ vendor/bin/phpstan clear-result-cache -c phpstan-debug.neon
PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes) in phar:///export/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/neon/src/Neon/Lexer.php on line 43
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes) in phar:///export/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/neon/src/Neon/Lexer.php on line 43

Expected output

I run analyse with --memory-limit so it's not an issue there, but clear-result-cache does not support this parameter.

I don't understand why it's relevant to load the baseline, when I just want to clear the result cache? No matter how big the base line is - result cache should be cleared. Only relevant setting processed should be the tmpDir configuration.

A workaround could be supporting --memory-limit for clear-result-cache as well?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions