-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
ISSUE-4798: Memory leaks in TestSuite class #4799
Conversation
- Do not store list of classes in property fix: sebastianbergmann#4798
This has been introduced in #2861 on purpose for some edge case. Let's make sure this PR does not introduce a regression. cc @kubawerlos. |
In order to reduce the memory usage I propose to store only the number of declared classes instead of the whole list of declared classes: $declaredClasses = get_declared_classes();
// some code
$newClasses = array_diff(get_declared_classes(), $declaredClasses); AFTER $numberOfDeclaredClasses = count(get_declared_classes());
// some code
$newClasses = array_slice(get_declared_classes(), $numberOfDeclaredClasses); |
Based on https://www.php.net/manual/en/function.get-declared-classes.php
It's maybe not the best idea to depend on behavior that may be changed, but let's try |
I've missed this change. Thanks EDIT here the full quote:
With this context I think we're safe. |
- use pointer to store defined classes state
@villfa I have implemented your suggestion |
When I apply this patch to
|
- remove unused imports
@sebastianbergmann For 9.x there is one more usage of |
And by "9.x" you mean "8.x", right? Because that is the target of this pull request. |
no 9.5, see your previous comment #4799 (comment) |
My bad, too early in the morning :) |
@sebastianbergmann What is the status of this OR? Is any further action is needed to merge it? |
I merged these changes into |
fix: Memory leaks in TestSuite class #4798