Remove create_function() from dml.php to save memory
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mahara |
Fix Released
|
Medium
|
Aaron Wells | ||
1.5 |
Fix Released
|
Medium
|
Aaron Wells | ||
1.6 |
Fix Released
|
Medium
|
Aaron Wells |
Bug Description
While trying to optimize memory usage in the mahara.org cron jobs (which keep crashing due to running out of memory), I noticed from the error stacks that it kept crashing on the call to create_function() in db_quote_
The reason for this, is because functions created by create_function() are never garbage collected. They persist for the lifetime of the script's execution. Which means that if you put it inside a loop that gets called thousands of times, it keeps using up more and more memory with new copies of the function, until the script crashes from running out of RAM.
There are about a dozen other usages of create_function() in Mahara's codebase, but this is the only one that's likely to be used in a large loop.
Changed in mahara: | |
status: | New → In Progress |
importance: | Undecided → Medium |
assignee: | nobody → Aaron Wells (u-aaronw) |
milestone: | none → 1.8.0rc1 |
Changed in mahara: | |
milestone: | none → 1.7.2 |
Changed in mahara: | |
milestone: | 1.7.2 → none |
milestone: | none → 1.6.6 |
Changed in mahara: | |
milestone: | 1.6.6 → none |
https:/ /reviews. mahara. org/#/c/ 2041/