Memory not free when screen closed


#1

Hi,
I used this method to navigate between screens
https://puravidaapps.com/tribblehunter.php
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.
Thanks


#2

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


Taifun


#3

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
Untitled066

Thanks


#4

Hi Thunkers,

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

Thanks


#5

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:


#6

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.
:thinking:


#7

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


#8

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

Taifun


#9

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