Hi,
I’m curious about a simple question: Does Lua (or Corona SDK) free all the memory consumed by the “local” variables that I created when the class (or function) finishes it execution?
Here is my code: (I’m using Director class by the way and this is my loading screen)
local levelElements = {} local roomBackgrounds = {} local levelObjects = {} local inventoryItems = {} local popupObjects = {} local popupAreas = {} local levelMusic = levelData.music levelElements["levelMusic"] = levelMusic for key, data in pairs (levelData.backgrounds) do local background background = display.newImageRect(data, display.contentWidth, display.contentHeight) background.id = key background.x = display.contentCenterX background.y = display.contentCenterY background.isVisible = false roomBackgrounds[background.id] = background end levelElements["roomBackgrounds"] = roomBackgrounds local bag = display.newImageRect(commonData.bag, pngLib.getPngInfo(commonData.bag).width, pngLib.getPngInfo(commonData.bag).height) bag.isVisible = false levelObjects["bag"] = bag levelElements["levelObjects"] = levelObjects director:changeScene({levelElements}, "scripts.levels.level" .. \_G.currentLevel, "crossfade")
Do I need to free my memory consumed by tables other than levelElements or Lua(or Corona SDK) does that by itself?