Beginner:Memory Management and Director Class

Hello!

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.

Thanks! [import]uid: 124625 topic_id: 21474 reply_id: 321474[/import]

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

[import]uid: 108660 topic_id: 21474 reply_id: 84997[/import]

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.

[import]uid: 79834 topic_id: 21474 reply_id: 85004[/import]

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 …:slight_smile:
Screen Transitions with Director Class:(Plus a playable game)
http://www.youtube.com/watch?v=KudLE8h4kWw

Lots of learning Corona Here:
http://learningcorona.com/

Hope this gets ya going…
Happy Coding
Larry
[import]uid: 107633 topic_id: 21474 reply_id: 85006[/import]

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

  • Carlito [import]uid: 124625 topic_id: 21474 reply_id: 85030[/import]

I’ve made a bare bones project template using Director 1.4 you may find useful…

The Bits

Just download and read the README
–Croisened
[import]uid: 48203 topic_id: 21474 reply_id: 85067[/import]

Woah!!! That’s fantastic, thanks. [import]uid: 124625 topic_id: 21474 reply_id: 85253[/import]