B4J Question High ram usage in ImageView

Waldemar Lima

Well-Known Member
Licensed User
High ram usage with ImageView, the more ImageView, the more ram is "swallowed"
Why does this happen?
1626197741399.png
I'm just doing a sketch
 
Last edited:

Waldemar Lima

Well-Known Member
Licensed User
what's strange is that I didn't do anything different in both :

I created an ImageView / Label in DesignerEditor -> Imported the image in the Files tab -> in Background Drawable I set BitmapDrawable an image and run it in Release
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
One classic cause of this apparent excess memory use is that images comprise a small managed (Java) object and a larger unmanaged native image. The Java garbage collector doesn't know about the large native object and so doesn't see the need to run a garbage collection when a reference goes out of scope so the memory use builds up until a collection is made. Don't obsess over this, it will get collected at some point.

If you do actually end up with out of memory problems by using lots of large images then you can call a garbage collection yourself but this is not really advised except in extremis.
Garbage collection | B4X Programming Forum
 
Upvote 0
Top