ISSUE:
Several users and I see "Lua error: not enough memory" in "water" when all its content is present, as in https://en.wiktionary.org/w/index.php?title=water&oldid=42726961 , and recently also in "man" https://en.wiktionary.org/w/index.php?title=man&oldid=42871191 . Errors persist despite efforts to simplify Lua-using templates in ways that do not reduce functionality.
The temporary workaround has been to split "water" onto two pages, and disable script support and transliteration of translations of "man"; this is undesirable because it reduces functionality. Many entries will one day be as complete as "water", so the issue will effect more pages if the causes are not addressed. (Indeed, in the last week another page developed an error.)
POSSIBLE SOLUTIONS:
We suspect Lua's garbage collection may have an issue: maybe individually not-intensive things, like individual templates, do not free up all their memory when they finish. If the issue is with Lua tasks not releasing memory when done, it would be ideal to improve that.
We also know some of our code is resource-intensive, so perhaps some errors could be solved if you could help us identify which pieces of code used on the above-linked revisions use the most memory, and how they could be streamlined without losing functionality (like automatic transliteration, etc).
Perhaps it would be possible to add "a function to create a 'cache' of language and script objects that can be used by multiple functions"; see explanation and rationale at https://en.wiktionary.org/wiki/Wiktionary:Grease_pit/2017/May#lsobjectcache .
Alternatively, perhaps it would be preferable to just raise the amount of memory that pages can use. (How would that affect mobile users?)
EXTRA DETAILS:
There is some randomness to the errors : I loaded https://en.wiktionary.org/w/index.php?title=water&oldid=42726961 and memory ran out in one place; I hard-refreshed and it ran out in another place. At the same time, there has consistently been no error in https://en.wiktionary.org/wiki/a or https://en.wiktionary.org/wiki/woman , even though "a" is larger than "man"; "a" and "woman" use more templates than "man"; and "woman" has ~2x as many translation templates (which are known to be resource-heavy and to contribute to errors) as "man".