anki icon indicating copy to clipboard operation
anki copied to clipboard

Adding many Mathjax Notes fills up Memory and causes Slowdowns

Open Libric0 opened this issue 2 years ago • 4 comments

Hello,

I am deeply enjoying Anki-Mathjax. Thank you for all your hard work!

I have likely found a memory leak connected to it: If one creates many mathjax cards, it impacts performance heavily. This can be seen in the following ways:

  • Rendering takes considerably longer after long usage
  • The QtWebEngineProcess fills up multiple gigabytes of RAM (On weak hardware might lead to a crash)

I am not deep into the source, but I suspect that after adding a card, the web-renderer is not "cleaned up".

Steps to reproduce:

  1. Add several cards with anki mathjax (about 40 or more)
  2. Notice performance and RAM usage

System:

  • Lenovo Thinkpad X390 Yoga
  • Fedora Linux 37 Workstation
  • Anki Version (Flatpak): Version ⁨2.1.57 (6b7d372c)⁩
  • Python 3.9.15
  • Qt 6.4.2
  • PyQt 6.4.0

Thank you for considering my Issue. I'll be happy to answer any followup questions

Libric0 avatar Feb 20 '23 17:02 Libric0

Edit: New update on flathub, still occurs with Version ⁨2.1.58 (ab8b1465)⁩ Python 3.9.15 Qt 6.4.2 PyQt 6.4.0

Libric0 avatar Feb 20 '23 21:02 Libric0

Hey @Libric0, could you confirm this issue with the official version Qt5 and Qt6 rather than with flathub?

You are welcome to continue using your distro's version of Anki if you prefer, but if you run into any issues, you will need to report them to your distribution's package maintainers. https://docs.ankiweb.net/platform/linux/installing.html

NamelessGO avatar Feb 22 '23 12:02 NamelessGO

Ah yes of course, i am so sorry I didn't think of it.

I reproduced it with the QT6 version.

Qt5 Will not start properly for me, just a bank canvas with a menu bar. So I won't be able to test it out here for now

Libric0 avatar Feb 22 '23 18:02 Libric0

Hello,

I’m still experiencing this issue with Anki 25.09.2 (using Python 3.13.7, Qt 6.10.0 and Chromium 134) on Arch GNU/Linux (I use the AUR anki-bin package). I entered a card with 14 mathjax fields, and Anki took 1 Go of my memory. Even after clicking “Add” and moving to another card, Anki still uses 1 Go of RAM.

Don’t hesitate to ask me further information.

jd-develop avatar Oct 24 '25 19:10 jd-develop