Hi gang,
I’m using director 1.2 in my app currently and am running into a memory leak but I’m not sure how to resolve it.
My app is structured like this:
I have my main exercise.lua files and in them is a single function call to a module that contains the bulk of the app routine in a function called routine(params).
All of that routine module gets returned to the exercise.lua and thusly controls the scene changes from inside that routine Module => exercise1.lua to exercise2.lua and so on, which then calls the external module routine again from each one.
This all works well in practice, however since the “localGroup” is located in the scene that is actually being run (the exercise.lua) and that group is not local to the module action where the scene change is called, I’m guessing that it’s throwing off the cleanUp action and localGroup isn’t getting cleaned. Is this true? Is there a better way to do this?
Each scene change i’m gaining about 15k. I’ve had tech support look at it, but since it’s director it’s kind of a touchy subject
Here’s an example of one of my exercise files so you see how simple they are versus what is happening in the actual routine module.
function new()
local pattern = require("pattern")
local word = require("word")
local exercises = require("exercises")
local wordExercises = require("wordExercises")
local exerciseOrder = require("exerciseOrder")
local general = require("general")
----------------------------------------------------------------------------------------
-- Display Group
----------------------------------------------------------------------------------------
local localGroup = display.newGroup()
local background = display.newGroup()
local routineGroup = display.newGroup()
localGroup:insert(background)
localGroup:insert(routineGroup)
----------------------------------------------------------------------------------------
--Common display objects
----------------------------------------------------------------------------------------
local bkg = display.newImageRect("assets/green\_chalk\_bkg.png", 1296, 768, true);
bkg.x = \_W/2 ; bkg.y = \_H/2
background:insert(bkg)
local letterExercise = pattern.routine("u")
routineGroup:insert(letterExercise)
return localGroup
end
Note: the “u” is a custom param to this particular exercise and needs to be passed through to the main module function. [import]uid: 10361 topic_id: 14622 reply_id: 314622[/import]