Keats/tera

Excessive memory usage of Tera

schungx opened this issue · 3 comments

I am using Loco (which embeds Tera) to render heavily-templated HTMX views.

My program consistently uses up to 5-6GB of RAM whenever complex Tera pages are rendered. Then this RAM stays (cached in Tera?) until a period of idleness (typically a few minutes), then Tera would dump them all off and the program RAM usage falls significantly (to below 1GB).

I am wondering: Is Tera caching the output of previous template runs or something? Why is it using so much RAM, and why does it keeps this memory alive for minutes?

Tera is not caching anything except for the template string and AST.

Do you know what can be using up gigabytes of RAM? I'm not rendering very large templates, at for-loops only at most 4-5 rounds. These are tests...

And it is strange that, after maybe 1 minute of inactivity, it suddenly releases all this memory all at once...

But if I don't touch Tera templates (e.g. use only the JSON API), nothing like this happens.

This may not be Tera related. Sorry for the false alarm. I'll close now.