Ghosts Vs Monsters Memory Leak

Hi all,

I’ve been having problems with memory leaks in my game.

I started off using the Ghosts Vs Monsters code as a base - i’ve now noticed that there is a large memory leak in the download source code for this.

Basically, the issue is that once the menu loads and the player plays level 1 and they choose (at the end of the level or via pause and exit) the Memory usage stays high back at the main menu,

If the player then goes to player 2 and returns to the main menu, the MemUsage remains even higher.

Can anybody identify the cause of the leak? It would help me greatly in my implementation.

Thank you [import]uid: 125592 topic_id: 26817 reply_id: 326817[/import]

I would suggest that you take a look at this excellent thread regarding memory leaks and how to prevent them: http://developer.anscamobile.com/forum/2012/05/21/guide-findingsolving-memory-leaks
[import]uid: 125239 topic_id: 26817 reply_id: 108856[/import]

Thanks for pointing this out, but i’ve read through this and the 101 guide, but i can’t see why the code is leaking,

Have you looked at the Ghost Vs Monsters code to be able to advise that the solution lay in that thread?

Thanks [import]uid: 125592 topic_id: 26817 reply_id: 108861[/import]

Despite trying to narrow my leak to other areas, I’m now pretty sure that my leak is now identical to that in the ghosts Vs monsters code.

Short of me trying to delve into this code - has anyone solved this in the past?

To summarise, each level (i know there are only two in G vs M!) causes an excess of 30kb. you play level 1 and exit to menu, 70kb is added. You quit level 2, and an additional 30kb is added.

Please Help! [import]uid: 125592 topic_id: 26817 reply_id: 109785[/import]

Sounds like something is not being cleaned up.
As there are big changes often to Corona, a lot of the sample apps stop working and are unsupported.
I had a brilliant idea for an app based on the Martian Control but later versions of Corona made it outdated and not supported.
The Flight Control app is ok for some situations but Martian Control was the perfect code base for what I wanted.
I hope you get an answer. [import]uid: 10389 topic_id: 26817 reply_id: 110395[/import]

Thanks for the heads up, its particularly frustrating, i’ll be putting some more time into it this evening, I’m new to developing so it’s often a case of not seeing the wood for the trees. I was hoping a more experienced pair of eyes might notice anything causing the problem in the G vs M source

Thanks again [import]uid: 125592 topic_id: 26817 reply_id: 110678[/import]

Hi neil6: I would strongly suggest to take a look at the following link

http://developer.anscamobile.com/forum/2011/11/19/corona®-profiler-line-line-analysis-your-code-promo-codes-included-0

There, you will find that the profiler is an extremely useful tool for this type of situation. Especially mode 4 which shows objects left behind during scenes transitions. It is worth 1000X the ~$10 price.

Check it out!

Mo [import]uid: 100814 topic_id: 26817 reply_id: 110697[/import]

Thanks for the message, I’ve tried profiled but didn’t find it of any use, I found little documentation.

When I tried mode 4 I did not know how to gain or interpret the result. I’d go from scene to scene not knowing where to it the profiler statements and then knowing what to do with any information.

Thanks to those who have helped me to this point I believe that my issue is with how the sample code in ghosts vs monsters cleans up, it does not seem to clear lua memory properly, but I do not know why…

I’m sure that I’m not leaving objects behind. Everything is nilled and I’m using director [import]uid: 125592 topic_id: 26817 reply_id: 110716[/import]

Hello, I used ghost vs monster as a basis for an important project and I need an urgent solution to the memory leak that explains neil6. Does anyone know how to fix it? Thank you very much

Hello, I used ghost vs monster as a basis for an important project and I need an urgent solution to the memory leak that explains neil6. Does anyone know how to fix it? Thank you very much