Beginner:Memory Management Help & Image Formats

Hello!

I have just started playing with Corona SDK with the help of a local friend, and since he is often not around, I am studying most of it by myself. Anyhow, I have a few questions I hope you Corona gurus can answer.

First, I love Corona SDK, but I have a problem which is common with many frameworks like this with documentation. The docs are not bad, but they often send you back and forth to blog posts, articles, and so on, sometimes with notes towards the bottom of the article. So I might have missed something and my question could be redundant, but even if you can just forward me to the right article, I’d appreciate it!

  1. Memory management: is there a clear documentation about what should be and what should not be my worry when managing resources in Corona SDK? I understand the whole local variable thing in Lua, but other than that, is there something else I should take care of?
  2. Image formats: am I right in saying that ALL images in Corona SDK are loaded as 32bit textures? So there is no reason for me to save images or sprites as 16bit stuff (other than file size)?

Thanks! [import]uid: 124625 topic_id: 21473 reply_id: 321473[/import]

Firstly, welcome! :smiley:

I’m glad to hear you’re enjoying Corona. (We know the docs need some work, we’re trying to improve them but it takes time.)

As to your questions;

  1. This article, if you have no read it yet, should cover everything about memory management in Corona; http://blog.anscamobile.com/2011/08/corona-sdk-memory-leak-prevention-101/

  2. This is correct, 32bit.

Peach :slight_smile: [import]uid: 52491 topic_id: 21473 reply_id: 85144[/import]

use director class

and override display.newImage function as shown below

[lua]local oldFunc = display.newImage
display.newImage = function (imgName,x,y)
local img = oldFunc(imgName,x,y)
localGroup:insert(img)

return img
end[/lua]

by doing this there are no chance to forgot insertion in group and/or worry to remove that image

for timers and transition you can find module in code sharing section forgot the name

how ever for spritesheets and sounds you have to fight with your code [import]uid: 12482 topic_id: 21473 reply_id: 85158[/import]

Thank you very much everybody, never had this much help in so little time!

[import]uid: 124625 topic_id: 21473 reply_id: 85251[/import]

@hgyvas - I saw your funny comments on those two spam threads earlier, they were amusing. (Almost a shame I had to delete the threads.) Good luck scoring that 5110 :wink:

@server - I’m happy to hear that :slight_smile: We have an excellent community here. [import]uid: 52491 topic_id: 21473 reply_id: 85263[/import]

oh noooooooo

now how can i get my 5110 that was my favorite mobile :frowning:

:slight_smile:

[import]uid: 12482 topic_id: 21473 reply_id: 85440[/import]

think i had a 5110 but of course i had one of those bag phones too [import]uid: 7911 topic_id: 21473 reply_id: 85445[/import]

I bought a 5510 a few years back - I’d always wanted one. They were COOL.

Peach :wink: [import]uid: 52491 topic_id: 21473 reply_id: 85450[/import]

wow thats also awesome hope corona support those devices :smiley:
by the way i still have my 5110 just its battery is not working and i can’t find any replacement for that :frowning: [import]uid: 12482 topic_id: 21473 reply_id: 85455[/import]

I’ve been trying to convince Carlos to support the 5510 for almost a year now but he always says the same thing; “Huh? uhhhh. zzzzz.”

Pretty sure that translates to “get lost!” :wink: [import]uid: 52491 topic_id: 21473 reply_id: 85494[/import]

ha ha
keep trying may be one day he will understand our feeling
:slight_smile: [import]uid: 12482 topic_id: 21473 reply_id: 85501[/import]