corona
corona copied to clipboard
Incorrect memory reporting
The memory reporting in Solar is incorrect.
local function loadImages()
for i = 1, 1000 do
local bg = display.newImage("logo.png" )
bg:translate(math.random(0, 960), math.random(0, 540))
end
print("Lua="..math.floor(collectgarbage("count")/1024).."MB, Texture="..math.floor(system.getInfo("textureMemoryUsed")/1048576).."MB"..", display objects="..display.currentStage.numChildren)
end
timer.performWithDelay( 50, loadImages, 100 )
After 100k images have been displayed sim reports around 20MB total memory being used but Windows reports memory load has increased 300MB.
Lua only knows about its own allocations. You're seeing it report the display objects' Lua-side tables, proxies, etc. but there's more heavyweight state on the native side, allocated with malloc()
or new
.
I figured that much. But, it is very misleading. Adding thousands of the same object "seems" to be quite cheap but actually it is very costly!
I am sure it is known the native side cost for display objects so this value could be either added to the Lua value or reported as an additional value?