Crazy memory usage in real-life applications

I was just clicking around Matt’s new Active Calculus + Doenet release and in particular Section 1.3. This tab on Firefox crashed three or four times before finally forcing a kill -9 on some other unrelated processes (rip to my vscode window), and when I went to about:processes to explore more, I found that it was using two gigabytes of memory.

(It also pegged my cpu for about thirty seconds while loading. Firefox said at one point that it was using 390% of cpu, which is (a) funny but (b) uhhh horrifying.)

I’m now getting a bit worried about trying to use these doenet activities in class (I’m one of the instructors who has agreed to field-test the new doenet stuff in AC). With long load times and tab crashes, students are going to get frustrated whenever I ask them to engage with one of these activities, I’m going to burn a bunch of class time waiting for things to load or reload, and nobody will be happy about learning calculus.

I know that there’s ongoing long-term work to write things in Rust to make things more performant, but are there shorter-term fixes we can use to make this semester start smoother? For instance, on pages with five or ten Doenet activities, can we load on-demand by default, rather than loading every activity at once?

Thanks for engaging with this inevitably kinda annoying question!

We’ve been working on short-term improvements for memory. We now have the ability to only load Doenet activities when they scroll into view and then “park” them to save memory when they scroll out of view.

For example, for this page, how is the memory load on your computer? It used to crash people’s browsers due to memory. Now it is supposedly set up to save memory. It seems to work on my computer, though I’m not sure how all browsers behave when an activity is “parked”.

Assuming that example works better, then the next step is to work with PreTeXt to take advantage of all these new features. (I thought the lazy loading, i.e., waiting until they are in view, was supposed to always be active, but it doesn’t seem like that is happening with the Active Calculus book.)

1 Like

This one works a good bit better. It hits about 600MB on first load, and then settles down to about 400MBish. It gets up to 2GB after scrolling all the way through but seems to remain reasonably responsive.

I asked PreTeXt to enable the lazy loading and parking features: https://groups.google.com/g/pretext-dev/c/kkF9ZJst3NI

1 Like