[Question] Addon taking around 30-40MB memory
Nillx opened this issue · 7 comments
Today i decided to check my addon's memory usage and noticed that LiteMount is taking up to 40MB memory, thats like logging addons similar to Auctionator or Weak auras. Is that normal?
The best I can give you is a "probably not, maybe".
LiteMount shouldn't use that much memory itself. For me it uses about 3-4MB. E..g.,
/dump UpdateAddOnMemoryUsage() or GetAddOnMemoryUsage('LiteMount')
[10:23:20] [1]=3145.642578125
But, LiteMount embeds some of the Ace3 libraries that it uses and many other addons also use (AceDB-3.0, AceSerializer-3.0, CallbackHandler-1.0 and LibDeflate). Only one copy of them is loaded into memory no matter how many addons use them, and the first addon to include them can get the memory usage for other addon's use of them counted against it.
If you want to see if this is the problem try disabling all other addons and seeing how much LiteMount uses then. Or
you can try installing the standalone copies of Ace3 (only on wowace I think) and LibDeflate.
Ah, I see. Yes this normal then. LiteMount will use extra memory temporarily (Edit looks like about 2.2MB) when activated, then release it again. WoW only cleans up the memory periodically not straight away, so the extra memory will be counted against LiteMount until that happens (called memory "garbage collection").
You can force WoW to clean up the memory by doing
/run collectgarbage()
which you should see free up the memory again. Or you can run
/dump collectgarbage() and UpdateAddOnMemoryUsage() or GetAddOnMemoryUsage('LiteMount')
I probably wouldn't recommend putting LiteMount on something as spammable as the mousewheel if this worries you.
Because it bugged me, I did some testing and reduced the temporary memory usage per activate from about 300kB to about 7kB. Updates are in LiteMount 9.2.19 and up.