The function "choice_get_response_data" uses quite a lot of memory as there is duplication of the responses that come back from the DB.
This is an issue for choices where there has been a large amount of responses(10,000+) as it's storing both the raw response and parsed response in memory.
I have posted a quick solution to this, by offsetting the logic to a separate function, ensuring that the response data is not stored in memory longer than it has to be.
Steps to Reproduce:
- Enrol 10,000+ users into a course.
- Answer choice for all 10,000 users(This can be done programmatically on a test site.)
- View a choice via /mod/choice/view.php?id=x
- Depending on your memory limit(ours was 128mb) the page will fail to load.