Memory leak?

Alextel69

Member
Hi
Yesterday I downloaded your beuatiful IDE trial. I created the same application as in helloworld tutorial. The only thing I added are pictures for different states of button. So I found a memory leak. I pressed button several times, then pressed home button so my app isn't closed and watched task manager. I found that after that RAM taken by app increases. If I reenter app without pressing button , RAM is ok. Is this a bug or like this works every android app?
 

Alextel69

Member
Good advice but I need these activities so user can return back. Is it possible to save somewhere current state of it and restore when needed?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
The JVM uses a garbage collector to release memory. This means that only when more memory is required, the unreferenced memory will be released.

It doesn't mean that it is not possible to create a memory leak by having a live reference
to a large (unneeded) object.
Usually you do not need to be bothered from memory usage unless you encounter an out of memory exception.

I recommend you to go over these tutorials:
http://www.b4x.com/forum/basic4andr...87-android-process-activities-life-cycle.html
StateManager - Helps managing Android applications settings and state
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…