View Single Post
06-25-15, 07:05 AM   #13
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by rowaasr13 View Post
If you use early returns the data is not even instantiated. Otherwise it all depends on how you programmed if you just build big table of all localization and never throw it away - it will stay in memory because, well, you put it here and didn't dispose it. Just don't do that.

There also source text and outer function bytecode itself - only Blizzard can tell if those are retained in memory after processing or not.
Try to login with the game with 5k "L" tables in every localization, then try to log in with only one set of tables, then compare the memory usage:

Lua Code:
  1. local AddonName, Addon = ...
  2.  
  3. local L = setmetatable({ }, {__index = function(t, k)
  4.     local v = tostring(k)
  5.     rawset(t, k, v)
  6.     return v
  7. end})
  8.  
  9. Addon.L = L
  10.  
  11. local locale = GetLocale()
  12.  
  13. if locale == "enUS" or locale == "enGB" then
  14.    
  15. elseif locale == "deDE" then
  16.    
  17. elseif locale == "esES" then
  18.    
  19. elseif locale == "esMX" then
  20.    
  21. elseif locale == "frFR" then
  22.    
  23. elseif locale == "itIT" then
  24.    
  25. elseif locale == "koKR" then
  26.    
  27. elseif locale == "ptBR" then
  28.    
  29. elseif locale == "ruRU" then
  30.    
  31. elseif locale == "zhCN" then
  32.    
  33. elseif locale == "zhTW" then
  34.    
  35. end

It doesn't really matter if your code doesn't run, if you put a file in the toc, then it will get loaded into the memory at least once per login/reload. My guess is that memory eventually will get garbaged, but it's still unnecessary loading time.

Last edited by Resike : 06-25-15 at 07:09 AM.
  Reply With Quote