Blizzard introduced the concept of tainted values in their implementation of lua, the size of internal structure may have grown as a result of it. 40 bytes is the size of the default implementation's data structure on 32 bits architecture.
You could possible get more accurate results if you do this:
collectgarbage()
UpdateAddOnMemoryUsage()
print(GetAddOnMemoryUsage("NewAddon")*1024)
for i = 1, 1000 do
local t = {}
end
UpdateAddOnMemoryUsage()
print(GetAddOnMemoryUsage("NewAddon")*1024)
So we create 1000 tables and throw it away, but don't call garbagecollect() right after so we don't GC them just yet. The memory increase divided by 1000 would then be very close to the an empty table's memory usage, since any other overheads would be divided by 1000.
I really don't get why there is this micro-dissection about memory use
I was just curious, its not for practical use. I had read about it on wowwiki and then the original poster in this thread said their table used x bytes and I was wondering how they knew.
So we create 1000 tables and throw it away, but don't call garbagecollect() right after so we don't GC them just yet. The memory increase divided by 1000 would then be very close to the an empty table's memory usage, since any other overheads would be divided by 1000.
76656
(76656-632)/1000 = 76.024
:(
I was just curious, its not for practical use. I had read about it on wowwiki and then the original poster in this thread said their table used x bytes and I was wondering how they knew.
That Blizzard has tweaked Lua to be their own version with taint concepts.