Beginner:Memory Management and Director Class


I am a complete beginner to Corona (you can see from other similar questions I am asking). I am using the Director Class and following some tutorials, but none of these tutorials explains to me how memory is handled by the Director Class.

When I replace a scene with another one, should I also free memory "manually", or are all the items in the local group freed automatically for me?

I am trying to read through the code, but I am a complete newbie and it is a bit complex for me.


if the items are all in a then they are freed up for you.
If there are system wide listeners, they need to be killed off by you.

Just to follow up with this. My understanding (and what I do) is that there are four things you need to dispose of and nil manually (so long as all objects are in your local group and all varibles and functions are defined as local).

1) Audio
2) Timers
3) EventListeners
4) SpriteSheets (not the spriteinstance, but the spritesheets themselves) - This is not something that I found that anyone had noted before when I originally searched, but I found that if they are not disposed then it did not free up the texture memory. It could be something that I am doing wrong though.

(I feel like I am missing one more)

Hopefully this helps. There should be examples of how to dispose of each of these if you search the API information.

Hello server.psfantasy,

Jeff is right, I also listed a couple of links for ya
the first one is a little older version of Director
but the principles are the same ....:)

Screen Transitions with Director Class:(Plus a playable game)

Lots of learning Corona Here:

Hope this gets ya going...

Happy Coding


Wow, thanks so much everybody, this will certainly keep me going!

- Carlito

I've made a bare bones project template using Director 1.4 you may find useful...

The Bits

Just download and read the README


Woah!!! That's fantastic, thanks.

views:4682 update:2012/2/13 9:11:28
corona forums © 2003-2011