-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
Reclaim used memory #11
Conversation
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Oh thats cool. Will have a look on this later on.
|
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Yes. It was an oversight on my part.
No.
No. It has 0 noticeable difference in performance calling it before the data is "cleared". |
So what would you think about this? Would that work? Did not test that yet. public function flush()
{
if ($this->data === []) {
return true;
}
gc_mem_caches();
$this->data = [];
return gc_mem_caches() > 0;
} |
In theory, yes. But running the tests - thats wrong. And as the The test results are pretty clear:
|
Calling gc_mem_caches() also has no effect for me in my real-world testcase (which I cannot share unfortunately). I'm still convinced that the actual issue lies somewhere in the laminas-cache base implementation (\Laminas\Cache\Storage\Adapter\AbstractAdapter::setItem), probably related to references getting attached to arrays inside objects in such a way that PHP's GC cannot resolve what is actual garbage that can be collected. |
@InvisibleSmiley I removed any referencing from the code and ran the test. Same problem. Even tho I did not checked any LoC, I think its not related to circular referencing. |
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ghostwriter can you please use the test case from #7 - if needed, put an $i = 0
outside the try {} catch () {}
to avoid "undefined variable" issues.
I still end up having my unit tests fail when applying the code changes in here so either there is something different with the test cases in this PR or anything else is going on.
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
It could be laminas/laminas-cache#14 and or https://bugs.php.net/70098 |
Closing this for now as the approach of this PR might not result to what the initial author was expecting. |
Description