Anki Forums

High Memory Usage over time on 2.1.44

Hello everyone!

I’m pretty much getting the same error as described here on Anki 2.1.44: Anki causing high RAM usage (v2.1.41) - #10 by owen13

Basically, over time the RAM usage keeps going up (highest I’ve seen is 6gb) and Anki gets progressively slower and slower until it takes multiple seconds to preview a card in the browser. Restarting Anki fixes it, but the cycle repeats itself.

What I’ve noticed is that hitting “Preview” in the deck browser window creates a new instance of the Qtwebengineprocess that isn’t removed when the window is closed. I’ve attached a screenshot below of what it looks like after I’ve previewed about 20 cards.

What I’ve tried to fix it:
Disabling all add-ons - same behaviour persists even with all add-ons disabled
Changing video driver to ANGLE - read that this fixed the issue for some users. I’m getting the same behaviour with ANGLE or OpenGL video driver. Unable to use Software driver since getting an error when starting Anki with that selected
Changing Anki versions - same behaviour on .48 and .31. Using 2.1.44 right now since some add-ons don’t work with .48

Misc Info:
i7-10750H 32gb RAM
Windows 10 21H1
Anki 2.1.44

Thank You!

4 Likes

This sounds like memory leak (ie. the program uses memory, then stops using it but forgets to free it so it looks like it’s still usinf it). It’s surprising, because python is GCed and Rust it should be impossible to leak memory unless when working explicitely with pointers.

This suggests that it’s not an Anki bug, but rather in a library, and if I had to guess, I would say Qt.

2 Likes

That’s what I’m thinking too. I just find it weird how there hasn’t been any widespread problems being reported, just a few forum posts here and there. That makes me think there may be some unique combination of factors causing this to occur?

FWIW, I fired up a VM earlier with a clean Windows 10 install and I’m getting the same behaviour I described above.

Anki has been leaking for years. Most people on the forums don’t post anything about it because they’re used to it.

It’s surprising, because python is GCed and Rust it should be impossible to leak memory

Maybe the culprit is the Qt library because it’s written in a very old subset of C++ with raw pointers and all such nasty stuff, but it’s a pure guess.

2 Likes

I just submitted a PR that should fix this.

6 Likes

Lol you have to explicitly call the Qt garbage collect from Python? WTF…

1 Like

Will this be in the next beta?

The same thing happens here too, and I’m using 2.1.44 + Windows 10 as well.
It usually happens if I keep Anki open for long periods of time (I suspect this problem is aggravated if I let my PC turned on but idle for some time - e.g. when I go have breakfast).

I also suspect that the combination Anki + VS Code make things is even more dramatic as I’ve experienced problems such as the computer reaching high temperatures, slowing down as well as buttons and words disappearing from context menu, start menu and windows (only the ones built in the OS. MS Edge and VS Code didn’t get affected, though).

It should be, yes.

1 Like