phql_internal_parse_phql() memory leak fix#16854
Open
nope7777 wants to merge 3 commits intophalcon:masterfrom
Open
phql_internal_parse_phql() memory leak fix#16854nope7777 wants to merge 3 commits intophalcon:masterfrom
nope7777 wants to merge 3 commits intophalcon:masterfrom
Conversation
Author
|
It looks like the Windows pipeline failures are caused by php/setup-php-sdk@v0.11, not by the changes in this PR. The issue appears to be fixed in v0.12 via php/setup-php-sdk#18. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello!
In raising this pull request, I confirm the following:
In long-running processes (like queue consumers) I call
Phalcon\Mvc\Model\Manager::__destruct()to clear the PHQL cache. This helps to prevent rapid memory growth, but memory usage still continues to slowly increase over time.It appears that the issue is caused by a call to
Z_TRY_ADDREF_Pinsidephql_internal_parse_phql:In this case,
ZVAL_ZVALalready increments the reference counter, and then it is incremented once again byZ_TRY_ADDREF_P. As a result, the reference count increases incorrectly and memory is not released as expected.Memory consumption after applying the fix:
The issue can be reproduced locally using the following example:
Thanks