Memory Leak ?

Hi All,
I am new to Corona and I am building an app for Android. The first version on Android is roughly 7 MB but on use the app starts “storing” data and that reaches upto 5 MB. I am not storing anything in my app.

Is it memory leak or is Android putting audio and images that I am using in cache which shows up as App Data?

regards,
Muddassir [import]uid: 144827 topic_id: 32599 reply_id: 332599[/import]

I was just wondering, I have some sounds and images in my app. If the users exits the app using back button or home button on Android or using home button on iPhone, will remove be called on my last scene. I suspect that the last scene does not get removed and thus all the sounds and images that I remove in exit scene function are not properly taken care of? [import]uid: 144827 topic_id: 32599 reply_id: 129653[/import]

Hi @smasherzz

This doesn’t sound like a “Memory Leak” in the traditional sense. Are you talking about the amount of space on the device or are you looking at something like the texture memory?

If its texture memory, its perfectly normal for your app to grow its memory footprint. As you load images, sounds and such, you take up more memory. What you don’t want to see is that number continue to climb as the player plays the game if you’re not adding new resources. Memory leaks occur primarily when you’re done with some resource like an image or chunk of audio and just don’t dispose of it or loose access to the object by creating another object using the same variable without freeing up the first one. Example, you’re doing a card game and you have a variable called card that you show the first card in. Then later, you want to show another card so you call display.newImageRect() and store the results in the card variable but you never removed the first card. Memory Leaked.d

If you’re talking about the amount of storage on the device increasing, then that is most likely Corona doing something to help you. Android APK’s are nothing but renamed ZIP archive files. Android magically uncompresses it in memory to use, but the resources included in the bundle are not accessible directly to Corona to load in. So things like images (jpg and png files) and a few others are extracted from the zip file and stored in the app’s sandbox so Corona can access them. This is likely why you would see the storage on the device go up after installation and first run.
[import]uid: 19626 topic_id: 32599 reply_id: 129659[/import]

I was just wondering, I have some sounds and images in my app. If the users exits the app using back button or home button on Android or using home button on iPhone, will remove be called on my last scene. I suspect that the last scene does not get removed and thus all the sounds and images that I remove in exit scene function are not properly taken care of? [import]uid: 144827 topic_id: 32599 reply_id: 129653[/import]

Hi @smasherzz

This doesn’t sound like a “Memory Leak” in the traditional sense. Are you talking about the amount of space on the device or are you looking at something like the texture memory?

If its texture memory, its perfectly normal for your app to grow its memory footprint. As you load images, sounds and such, you take up more memory. What you don’t want to see is that number continue to climb as the player plays the game if you’re not adding new resources. Memory leaks occur primarily when you’re done with some resource like an image or chunk of audio and just don’t dispose of it or loose access to the object by creating another object using the same variable without freeing up the first one. Example, you’re doing a card game and you have a variable called card that you show the first card in. Then later, you want to show another card so you call display.newImageRect() and store the results in the card variable but you never removed the first card. Memory Leaked.d

If you’re talking about the amount of storage on the device increasing, then that is most likely Corona doing something to help you. Android APK’s are nothing but renamed ZIP archive files. Android magically uncompresses it in memory to use, but the resources included in the bundle are not accessible directly to Corona to load in. So things like images (jpg and png files) and a few others are extracted from the zip file and stored in the app’s sandbox so Corona can access them. This is likely why you would see the storage on the device go up after installation and first run.
[import]uid: 19626 topic_id: 32599 reply_id: 129659[/import]

Thanks for the help Rob.

I am looking at the my app inside the “Manage Apps” facility in an Android. At installation the Storage stats are:
Total 7MB
Application 7MB
Data 4KB

Over using all the functionalities of the app once the stats become:
Total 12MB
Application 7MB
Data 5MB

The Data remains at 5MB and does not increase further if I continue using the app. [import]uid: 144827 topic_id: 32599 reply_id: 129755[/import]

I don’t believe this is any thing to worry about. [import]uid: 19626 topic_id: 32599 reply_id: 129766[/import]

Thanks for the help Rob.

I am looking at the my app inside the “Manage Apps” facility in an Android. At installation the Storage stats are:
Total 7MB
Application 7MB
Data 4KB

Over using all the functionalities of the app once the stats become:
Total 12MB
Application 7MB
Data 5MB

The Data remains at 5MB and does not increase further if I continue using the app. [import]uid: 144827 topic_id: 32599 reply_id: 129755[/import]

I don’t believe this is any thing to worry about. [import]uid: 19626 topic_id: 32599 reply_id: 129766[/import]

thanks for the help :slight_smile: [import]uid: 144827 topic_id: 32599 reply_id: 129802[/import]

thanks for the help :slight_smile: [import]uid: 144827 topic_id: 32599 reply_id: 129802[/import]