Because of these posts/threads:
https://www.b4x.com/android/forum/threads/out-of-memory.10760/#post-62144
https://www.b4x.com/android/forum/threads/java-method-recycle-not-found.17950/#post-104268
I have been attempting to manage out of memory problems by using the following code as soon as I finish with a large bitmap:
However both the reference posts/threads are 4 to 5 years old.
Some other reading seems to suggest that the "recycle" approach was useful because various bits of bitmaps were kept in different heaps and "recycle" would immediately release the actual pixel data (the main memory gobbler).
Looking at:
https://developer.android.com/training/displaying-bitmaps/manage-memory.html
specifically this quotation:
Does the bold sentence above negate the rationale for using reflector.RunMethod("recycle") on Android 3.0 and above or is the approach still valid?
https://www.b4x.com/android/forum/threads/out-of-memory.10760/#post-62144
https://www.b4x.com/android/forum/threads/java-method-recycle-not-found.17950/#post-104268
I have been attempting to manage out of memory problems by using the following code as soon as I finish with a large bitmap:
B4X:
reflector.Target = bitmap
reflector.RunMethod("recycle")
However both the reference posts/threads are 4 to 5 years old.
Some other reading seems to suggest that the "recycle" approach was useful because various bits of bitmaps were kept in different heaps and "recycle" would immediately release the actual pixel data (the main memory gobbler).
Looking at:
https://developer.android.com/training/displaying-bitmaps/manage-memory.html
specifically this quotation:
On Android 2.3.3 (API level 10) and lower, the backing pixel data for a bitmap is stored in native memory. It is separate from the bitmap itself, which is stored in the Dalvik heap. The pixel data in native memory is not released in a predictable manner, potentially causing an application to briefly exceed its memory limits and crash. As of Android 3.0 (API level 11), the pixel data is stored on the Dalvik heap along with the associated bitmap.
Does the bold sentence above negate the rationale for using reflector.RunMethod("recycle") on Android 3.0 and above or is the approach still valid?