-
Task
-
Resolution: Fixed
-
Minor
-
3.7
-
MOODLE_37_STABLE
-
MOODLE_37_STABLE
-
This is a backport of MDL-66234, copying its description below:
Further testing for MDLSITE-5663 revealed that a chunk of data was not removed by PHP's garbage collector. After several days investigating the issue I ended up identifying a late initialisation of the CLI renderer as the root cause for the memory leak. $PAGE is not initialised until the grades API (required by one of the indicators used in the model) is called, moodle_page::_wherethemewasinitialised is then set to debug_backtrace() which contains the indicator instance so the instance is not garbage collected until the end of the script, when moodle_page is destroyed, blocking that chunk of data allocated in PHP's memory until the end of the script. PHP instances are not removed from memory when there are references to them, even when calling unset($instance) and this is what was happening in this case.
The provided patch includes a couple of performance improvements to free memory back to the OS as soon as possible.
- will help resolve
-
MDL-66234 Extra garbage collection for analytics
-
- Closed
-