Memory not free when screen closed


I used this method to navigate between screens
But i noticed that the memory not freed after close and open another screen and the app crash after navigate between the screens.
Please help to solve this problem.


how did you notice that?
are you displaying several large images? did you also follow tip 2?



Hi Taifun,

I notice that with top command using ADB
Yes i have several images with dimensions 200x320 but the app not crashed when load all images, it crash after open another screen and start loading other images
Here is the block that used to close screen and open another



Hi Thunkers,

Any solution to clear memory when close screen and open another? :thinking:



As @Taifun pointed out and also from your above reply :point_down:

it looks like your app is crashing because the app is not able to load all the images when the particular screen initializes.

Follow the topic and the tip mentioned in @Taifun’s above reply and then share here whatever the result is :slight_smile: :+1:


Hi @Vaibhav_Patil,
The app is able to load images when screen initialized because all screens duplicated from screen1.
The app is crashing because of OutOfMemory and the memory not freed when navigate beetwen screens.


It could be because, the previous screen didn’t fully close, so it’s loading the previous screen images and the current screens images.


this sounds like you could simplify your app…
how man screens are you using?
see also Building Apps with Many Screens



Hi Taifun,
I use 5 screens, one for splash screen and others to navigate between them.