Closed ellisonpatterson closed 1 year ago
Is this null safety?
No it prevents the memory leak as discovered here: https://github.com/discord-php/DiscordPHP-Http/issues/19
It seems that the checkQueue anonymous method never gets cleared from memory after it stops being called, so memory slowly goes up.
After nullifying it, and running the test script from the issue, memory does not increase and stays the same.
I'm asking if setting them null
won't cause problem to those checkQueue()
calls since you did not check for that
I have not seen any issues with this patch on my bot. It has been running for 24 hours with no problems.
I am setting them null
if it's not going to call $checkQueue
again.
It seems that inside the checkQueue method, the anonymous function defined as the same name is causing a memory leak.
If we forcefully set the variable to null when we will not be calling it recursively, it stops the memory leak from occurring.