nikic / PHP-Parser

A PHP parser written in PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PHP Fatal error: Allowed memory size of x bytes exhausted

Daijobou opened this issue · comments

Hello, I try to install psalm (vscode exentsion) and call command-line psalm -init src and after few seconds its shows

PHP Fatal error: Allowed memory size of 8589934592 bytes exhausted (tried to allocate 528384 bytes) in AppData\Roaming\Composer\vendor\nikic\php-parser\lib\PhpParser\Lexer.php on line 88

https://github.com/nikic/PHP-Parser/blob/4.x/lib/PhpParser/Lexer.php#L88

Tested in Windows 11 with PHP 8.1.4 / 8.2.7

You hit a memory limit of 8GB, which is more than the AST of an a very large file would take up (unless you have some truly massive ones...) I expect the problem here is that Psalm is keeping a lot of data structures in memory and they can grow to that size on large projects. I don't think that's something I can address though.