Some Memory Questions (mostly movieclip)

Hi all

I’m almost finished my first Corona-based app, but there is still an issue of memory leakage in the end result i think, particularly when using movieclip

-is there a way to instance an image in memory so if i do 4 animations with the same image that it isn’t loaded into memory 4 times? (or is this already somehow handled?)

-similarly to above, movieclip aside how about repeating just normal display objects on-screen, are these all loaded per instance or just referenced?

-what’s the procedure for destroying a movieclip object? i get rid of event listeners, display.remove it then nil it, and yet there’s a very noticeable chugging of the game after a relatively short amount of time, so i’m assuming it’s something that I’m doing wrong? I’m hoping that’s it anyway, if there’s an issue with movieclip then I’ve rather a lot of work to redo in some other way :confused: [import]uid: 71799 topic_id: 12698 reply_id: 312698[/import]

corona is optimized to not load the same image twice. it spawns a shallow copy. but only on images. for other non image objects, they get created.

c [import]uid: 24 topic_id: 12698 reply_id: 46543[/import]

Ah that’s great, got a minesweeper-style game grid up so was paranoid i’d done that one wrong wrt static images, cheers! [import]uid: 71799 topic_id: 12698 reply_id: 46556[/import]

Just wondering again about movieclip, as I use the same two images but delete and recreate them multiple times which seems to be causing my leaks

if I create one of each animation object, then deep copy (http://lua-users.org/wiki/CopyTable) will I be able to create multiple instances of the same animation? i.e. are the images stored in there as a reference?

That way when i exit that level I’m only failing to destroy two animation objects instead of dozens… [import]uid: 71799 topic_id: 12698 reply_id: 46592[/import]