Memory leak? (over time)

When I leave Anki sitting in the background it seems that over time it’s memory usages goes up. Right now It was 1,17G. Restarting it brings it to reasonable ~250M but over time it grows again.

I’m on macOS Sequoia and latest Anki:

Version <U+2068>24.06.3 (d678e393)<U+2069>
Python 3.9.18 Qt 6.6.2 PyQt 6.6.1

There is Bug - Memory Leak (MacOS) which is now closed (argh, why the auto close?! :confused: ) and from the quick test memory usage with software rendered is lower though seems to be climbing as well. However biggest jumps I noticed were during sync, which should be affected by the renderer?

1 Like

Yes unfortunately, my issue was auto-closed because of no responses. You can try as a quick fix to change the video driver to software (That’s what fixed it for me, but remember to restart the app!). Also 1.17 GB doesn’t seem to be that high to me, my Anki can get to 4-5 GB if I keep it open for a couple days.

You can also check out the anki docs troubleshooting page (can’t post links for some reason)

3 Likes

It was only from a day being opened… it got to a higher value after a couple of days (like 2-4G if memory servers me right)…

For now I just restart it every now and then but it would be better to have the leak plugged :slight_smile:


Same issue here. I have no plugins. Video driver is metal (default).
Anki 24.06.3 (d678e393)
Python 3.9.18 Qt 6.6.2 PyQt 6.6.1
Platform: macOS-15.0.1-arm64-arm-64bit

1 Like

I have the same problem over here. Anki annihilates my RAM by the end of the day. I have to keep restarting Anki every now and then. I don’t know if this is a performance issue or is it due to my card count (I have 70k plus cards).

Reducing the number of addons helps though…

@wojtek @manishkr @DerIshmaelite
[and @UrArt – you too, if you’re still seeing the issue.]

Can you each provide the following information (if you haven’t already)?

  1. Go to Anki > About, click Copy Debug Info, and paste that entire result here.

  2. Have you tried all of the available video drivers? (see Troubleshooting #6)

  3. Do you see the same issue with your add-ons disabled? (see Troubleshooting #2)

1 Like

I changed my video driver to Software. Let’s see if it helps. Anki’s RAM consumption was clocking 4-5 GB.

Anki 24.06.3 (d678e393)  (ao)
Python 3.9.18 Qt 6.6.2 PyQt 6.6.1
Platform: macOS-15.0.1-arm64-arm-64bit

===Add-ons (active)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
Audio Playback Controls ['312734862', 2023-04-23T01:25, 'None', '']
AwesomeTTS - Add speech to your flashcards ['1436550454', 2024-09-14T08:04, 'None', '']
Card Info During Review ['2179254157', 2023-11-14T06:56, 'None', '']
Deck Stats ['1421528223', 2021-06-12T15:30, 'None', '']
Deck name in title 21 ['699175524', 2019-09-26T13:19, 'None', '']
Highlight Search Results in the Browser ['225180905', 2023-10-21T21:17, 'None', '']
ImageResizer ['1214357311', 2023-12-03T02:58, 'None', '']
More Overview Stats ['2116130837', 2024-04-15T20:07, 'None', '']
Progress Graphs and Stats for Learned and Matured Cards ['266436365', 2020-03-29T08:26, 'None', '']
True Retention by Card Maturity ['923360400', 2018-08-19T13:04, 'None', '']

===IDs of active AnkiWeb add-ons===
1214357311 1421528223 1436550454 2116130837 2179254157 225180905 266436365 312734862 699175524 923360400

===Add-ons (inactive)===
(add-on provided name [Add-on folder, installed at, version, is config changed])

It seeed to happen less with “Software”. I’ll now try with OpenGL (the problem is it takes a bit of time to reproduce)

From my test it seemed to happen with addons disabled as well.

1 Like

You’re using Windows. Do you have some reason to think what you’re seeing is related to this MacOS issue?

[I appreciate your thoroughness, but feel free to cut out (or tuck into a Details block) the 100 inactive add-ons from you post above. You might also consider deleting them from your Anki install as well. (Before you ask, I don’t know of any particular issues that could be caused by having 100 inactive add-ons.)]

You’re using Windows. Do you have some reason to think what you’re seeing is related to this MacOS issue?

This is not just a MacOS issue, I am experiencing this as well in Windows. The RAM usage is enormous. For now, I have changed to Software as Video Driver and deleted the inactive addons. I will see in a couple of hours how Anki performs. Right now it has a 455 MB RAM usage over 1+ hours of usage, which is a sign of improvement.

Anki 24.10 (23b7d636) (ao)
Python 3.9.18 Qt 6.6.2 PyQt 6.6.1
Platform: Windows-10-10.0.22631

===Add-ons (active)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
Additional Card Fields Fork for 21 [‘744725736’, 2022-10-23T12:10, ‘None’, ‘’]
Advanced Review Bottom Bar [‘1136455830’, 2024-08-22T13:04, ‘None’, mod]
Anki Leaderboard - Compete with friends to boost motivation Fork by Shige [‘175794613’, 2024-10-19T16:12, ‘None’, mod]
Customize Keyboard Shortcuts [‘24411424’, 2023-11-01T10:17, ‘None’, mod]
Deck name in title 21 [‘699175524’, 2019-06-01T03:05, ‘None’, ‘’]
Edit Field During Review Cloze [‘385888438’, 2024-01-03T08:19, ‘6.18’, mod]
FSRS Helper Postpone Advance Load Balance Easy Days Disperse Siblings [‘759844606’, 2024-10-10T04:36, ‘None’, ‘’]
Highlight Color Shortcut [‘1178291236’, 2021-04-01T18:42, ‘None’, mod]
Image Occlusion Enhanced [‘1374772155’, 2022-04-09T09:15, ‘None’, ‘’]
Lapse Review Ratio Tools [‘1792307359’, 2024-04-14T23:27, ‘None’, ‘’]
Leech Toolkit kar branch [‘568675395’, 2024-03-07T16:25, ‘None’, ‘’]
LifeDrain(custom) [‘LifeDrain(custom)’, 0, ‘None’, mod]
Mini Format Pack [‘295889520’, 2023-11-02T19:00, ‘None’, mod]
Rebuild All Empty All for Anki 21 [‘1810938259’, 2018-07-20T06:40, ‘None’, ‘’]
SwiftAnki Quick Anki Navigation with Keyboard Shortcuts [‘1467361433’, 2024-09-13T23:38, ‘None’, ‘’]
Toggle front and back card in Anki 21 [‘1240106570’, 2019-07-21T15:19, ‘None’, ‘’]
Word Shuffler - Sentences randomizer [‘1190756458’, 2021-03-30T23:45, ‘None’, ‘’]

===IDs of active AnkiWeb add-ons===
1136455830 1178291236 1190756458 1240106570 1374772155 1467361433 175794613 1792307359 1810938259 24411424 295889520 385888438 568675395 699175524 744725736 759844606

===Add-ons (inactive)===
(add-on provided name [Add-on folder, installed at, version, is config changed])

Anki 24.06.3 (d678e393)  
Python 3.9.18 Qt 6.6.2 PyQt 6.6.1
Platform: macOS-15.0.1-arm64-arm-64bit

Changing the video driver to software seems to have solved the issue, but the problem remains with Metal and OpenGL. Also, I have no add-ons.

1 Like

After about 1 day with “OpenGL” I already see ~1G usage:

Should I retry it with Software now?

Is thre something like “heapdump” akin to what Java has so it would be possible which objects are allocated and what allocated them? (and/or any sort of profiler)

EDIT: It looks like memory spike happens mostly after synchronisation…

Another day and another bump:

I’ll switch to Software now and test.

EDIT: Fresh after restart with Software (for comparisone):

Just tagging onto this a bit, in the event that it’s helpful:

I usually see a bit of a memory leak in Anki over time but have just gotten into the habit of restarting it on occasion and it has never much been the bother.

Today, though, I ran into something that seemed notable. I was scrolling through a new deck, previewing cards via the previewer from the browser. Upon scrolling for a bit I noticed the image rendering slowing down a bit and, just on a hunch, looked at the memory consumption of Anki:

Wayyy above normal. Was not like that before I started scrolling (was about 1.5 GB) and as soon as I closed the browser went down to about 2.5 GB.

Not sure if it’s useful to any of you kind souls much smarter than I in the ways of Anki but it stood out as being potentially odd so I thought I’d share.

FWIW I’m on 24.06.2 Qt 6 on Mac.

Could you say what your collection size is (as if that played a role) :question:

collection.media is about 15GB

Your screenshot that included the QtWebEngineProcess reminds me of an issue that has come up before – certain windows leaving their Qt process running even after they are closed. No single one takes that much memory, but they build up. Try to think about how many times you open Browse, Add, Edit Current, Stats, etc. in a day – or even in an hour!

I have not found it to be an issue in native Anki windows (anymore), but I’ve seen it happen in several add-ons (yes, even high-quality, reputable ones).

Preview isn’t one that stays open, but it does take another little bite of memory each time it renders a new card.

It’s this time of the day - after roughly 24h with Software rendered memory usage keeps low:

Even with quite

1 Like

With software Anki keeps memory usage low (another 24h so 2 days now):

1 Like

I am having the same issue. The RAM goes up to 11.5 gigs once I’m in the card browser. I tried changing the video driver to Software, but the issue persists. I can’t really use the browser, and Anki inevitably crashes in about 45 minutes, and this is impacting my studies. Any help would be greatly appreciated!