Skip to content

Conversation

@Saaweel
Copy link

@Saaweel Saaweel commented Jan 13, 2026

PHP memory limit

Prevent excessive memory usage when rendering or processing PRT graphs with very deep or cyclic node structures.

Ensure that the same PRT node is not processed more than once inside compute_heuristic_xs() in graph.php.

This avoids unbounded traversal in long chains where each node delegates both true and false branches to the next node, which can otherwise lead to rapid memory growth and PHP hitting the memory limit.

Also:

  • Track already-visited PRT nodes during graph traversal.
  • Prevent repeated processing of identical nodes.
  • Avoid infinite or pathological recursion in deep PRT graphs.
  • Preserve existing PRT logic and grading behaviour.

Zulipchat conversation

@sangwinc
Copy link
Member

Thanks @Saaweel much appreciated. Could you email me a question which "provoked" this change? It would be good to have one or two really complex questions in the unit testing framework, and these would help.

@sangwinc sangwinc merged commit cacf8ec into maths:dev Jan 15, 2026
3 of 4 checks passed
@Saaweel
Copy link
Author

Saaweel commented Jan 15, 2026

Thanks to you @sangwinc, sure, I'll send you the question right now.

@Saaweel Saaweel deleted the php-memory-limit branch January 15, 2026 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants