Thread Tools Display Modes
Prev Previous Post   Next Post Next
03-22-13, 10:26 AM   #1
Benalish
A Flamescale Wyrmkin
 
Benalish's Avatar
Join Date: Dec 2012
Posts: 123
Unusual memory usage

In my addon I noticed an unusual use of memory ranges from 200 kb to 1.10 mb. After several tests, I found the cause of this oscillation, located inside a function. I noticed that disabling (commenting) the other lines and leaving only this, the oscillation is still present. This function is called every OnUptate, and setting a refresh rate relatively high (about 50 sec) memory usage becomes stable.
I do not write the whole code because the source problem is only here

Lua Code:
  1. function buffscan()
  2.         -- lines disabled
  3.     local meow = { "a","b","c","d","e","f","g","h" }
  4.         -- lines disabled
  5. end
  6.  
  7. local timer = 0
  8.  
  9. local function onUpdate(self,elapsed)
  10.     timer = timer + elapsed
  11.     while (timer >= 0.75) do
  12.         if (not db.profile["Locked"]) then
  13.             for x, key in ipairs(db.profile["Bars"]) do
  14.                 for y = 1, db.profile.Bars[x].columns * db.profile.Bars[x].rows do
  15.                     buffscan()
  16.                 end
  17.             end
  18.         end
  19.         timer = timer - elapsed
  20.     end
  21. end
  22.  
  23. local f = CreateFrame("frame")
  24. f:SetScript("OnUpdate", onUpdate)
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Unusual memory usage


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off