Hi. I answered a similar question the other day so I just amended my example for that question.
You can download two examples here:
https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2016/12/correct_management.zip
- question1_161216 - Creates and destroys semi-complex content in a scene over and over using will/did mechanisms, then looks for memory leak.
- question2_161223 - Using create + did hide + removeScene. Again, looks for leaks.
Warning: To run it directly you will need SSK2 PRO or lite.
However, you can read the code and see what I’ve done. Pay particular attention to scene2.lua.
(Also, this code is easily modified to not use SSK2 if you want to use it for your own example.)
I just ran the question2_161223 example for 10 iterations with Corona SDK 2016.3001 and observed no leaks.
-Ed