iOS Question Freeing up bitmap memory

JackKirk

Well-Known Member
Licensed User
Longtime User
Not sure if this is a question or comment - but would like some feedback.

I have just successfully (I think) got running an "infinite" scrolling images application that does the "make new images in scroll direction, delete old images in trailing direction" trick.

To delete the old images I found 2 forum hits:

1. https://www.b4x.com/android/forum/threads/how-to-unload-an-image-to-free-resources.55938/post-352064
by Erel which suggests:
B4X:
ImageView.Bitmap = Null
This does not work - I get:
-----------------------------------------
2. https://www.b4x.com/android/forum/threads/reset-imageview-bitmap-bitmap-null-fails.69886/post-657831
by Semen Matusovskiy which suggests:
B4X:
Dim no As NativeObject
imageView1.Bitmap = no.Initialize ("UIImage").RunMethod ("new", Null)
Which seems to work - but not sure how to test.
-----------------------------------------
Am I doing something wrong that stops Erel's solution (which seems much more elegant) from working?

Is there a way to test if solution 2 is actually freeing memory?

Thanks....
 
Last edited:

JackKirk

Well-Known Member
Licensed User
Longtime User
There is more elegant way. Declare, for example, Dim DummyBitmap As Bitmap and use it in MyBitmap = DummyBitmap only.
What happens if the bitmap to be dummied is in an imageview - would memory be cleared?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…