Problem/Motivation

When scanning modules sometimes I get Allowed memory size of 134217728 bytes exhausted from PHPStan although the PHP memory limit is 512MB.

Steps to reproduce

TBD

Proposed resolution

Not sure the best solution but it works for me to append --memory-limit=-1 to the phpstan analyze command.

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#4 3224829.patch724 bytesGábor Hojtsy
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mstrelan created an issue. See original summary.

Gábor Hojtsy’s picture

Title: PHPStan memory limit » Set PHPStan memory limit on exec()
Category: Support request » Task

Right, since we execute phpstan in its own process, it would use the PHP CLI memory limit, not the one that normally applies to Drupal. Would there be potential downsides setting the memory limit to -1?

aangel’s picture

I just hit this issue and adding that extra switch worked for me.

Hard to see downsides to giving PHP free reign with memory in this case, after all it's a tool run sporadically and typically on dev machines. Even if run on production, the memory increase is localized to just the tool rather than it being a production-wide modification.

Gábor Hojtsy’s picture

Status: Active » Needs review
FileSize
724 bytes

Ok that would look like this. Let's get it tested.

  • 06aa4e9 committed on 8.x-3.x
    Issue #3224829 by Gábor Hojtsy, mstrelan, aangel: Set PHPStan memory...
Gábor Hojtsy’s picture

Title: Set PHPStan memory limit on exec() » Set PHPStan memory limit to unlimited on exec()
Status: Needs review » Fixed

Ok got this in. Will see if there are any complaints.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.