Director cleanUp question

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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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             
views:1393 update:2011/10/12 18:33:00
corona forums © 2003-2011