-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpKernel] Fix mem usage when stripping the prod container #18048
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
Conversation
a0ba18f
to
db5b21a
Compare
db5b21a
to
c8cb253
Compare
👍 |
@nicolas-grekas, I ran some tests on my container after patching these changes into 2.8. In each case I did a hard clear of cache, followed by an apache restart as opcache memory usage wasn't being reported consistently without it. Dev
Original - token_get_all
Mine - php_strip_whitespace
Proposed - single star opening comments
Summary
For this last point when I investigated the Container I saw various extra classes and methods with double-commented sections. It's possible that this could have been my patching of the changes but I found it much simpler to just do the following instead of your
With this version I had no other negative impact, the container comment blocks were all In addition to these changes Do you want to update your PR or would you prefer me to make one? |
|
@peteward the delta you get is because this patch is for 2.3 and you apply it on 2.8, where a few more stars have to be removed. |
See other PR - it's ProxyManager. I created my PR from a new branch from 2.3. |
c8cb253
to
5f1ce34
Compare
@peteward I added an str_replace on proxy-generated code. I now need to confirm this code can't contain arbitrary string values. |
@Ocramius quick help needed plz: is it possible that a generated proxy class contains an arbitrary string, or are they all generated from well know templates so that the |
The output looks to be formulaic from my container here... |
I can't guarantee what you just asked for. |
5f1ce34
to
4fa5844
Compare
@Ocramius OK thanks, |
I was reluctant at reintroducing stripComments but running Looks like a complete fix, great work 👍 |
Cool, thanks checking! |
👍 |
Thank you @nicolas-grekas. |
…er (nicolas-grekas) This PR was merged into the 2.3 branch. Discussion ---------- [HttpKernel] Fix mem usage when stripping the prod container | Q | A | ------------- | --- | Branch | 2.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #18007 | License | MIT | Doc PR | - I propose to just replace doc comments by regular comments, so that the parser removes them and opcache doesn't have to keep them in memory, which is the target. Commits ------- 4fa5844 [HttpKernel] Fix mem usage when stripping the prod container
This PR was merged into the 3.4 branch. Discussion ---------- [DI] remove inheritdoc from dumped container | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no <!-- don't forget to update src/**/CHANGELOG.md files --> | BC breaks? | no | Deprecations? | no <!-- don't forget to update UPGRADE-*.md files --> | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | The inheritdoc without adding text is pointless on it's own as any decent IDE will show that those methods are overwriting the base method. This removes it from the dumped container to remove memory and generation time. This goes in the same direction as #23673, #18048 and #24342 It does not affect phpdocs of the compiled container that might actually be useful (factory methods of services explaining if the service is private, shared etc.). Commits ------- d779845 [DI] remove inheritdoc from dumped container
This PR was squashed before being merged into the 6.4 branch. Discussion ---------- Deprecate `Kernel::stripComments()` | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead --> | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> This PR replace `method_exists` by `class_exists` in order to check if component is available. It harmonize codebase ~This PR remove checking if method `Kernel::setIgnore` exists.~ ~This method was introduced in symfony 2.3 (#18048), so now it's always available~ Commits ------- 43c5038 Deprecate `Kernel::stripComments()`
I propose to just replace doc comments by regular comments, so that the parser removes them and opcache doesn't have to keep them in memory, which is the target.