Android Question B4xPages memory usage

PSEAD

Member
Licensed User
Longtime User
I currently have an app with many pages which I originally had as a single activity (using panels), but I eventually changed the whole thing to use separate activities due to running out of memory (still in development). Will B4x pages not do the same as my original app and run out of memory if all the objects are kept alive and active?
I am asking before I change the app to use B4xPages.
 

JohnC

Expert
Licensed User
Longtime User
I also was wondering this too because if you keep adding new panels with new views on them, then won't all these views be loaded at the same time and take up memory?

I was also wondering instead of using different panels with one activity, what about simply using different "layouts" and one activity, this way only the views in the current layout get loaded into memory, and when a new layout is loaded, all the views on the old layout are unloaded from memory - or am I misunderstanding this?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I was also wondering instead of using different panels with one activity, what about simply using different "layouts" and one activity, this way only the views in the current layout get loaded into memory, and when a new layout is loaded, all the views on the old layout are unloaded from memory - or am I misunderstanding this?
Yes. It will not save anything that any user will ever notice.

B4XPages memory usage is similar to the memory usage of activities and can be actually lower in some cases. Activities are also not destroyed when they are on the stack.

99% of memory issues are related to bitmaps and canvases. A single bitmap will take more memory than hundreds of panels.
If you encountered memory issues then you held too many images in memory. If you have many pages with many images then it makes sense to remove images as the page disappears and load them again when a page appears.
 
Upvote 0
Top