A game app that I'm working on causes problems on my Galaxy S3 smartphone. Regardless of the type of debug mode (Legacy, Rapid, or Release), after the app has started, I only need to change the Orientation two times when many "downsampling image" status lines then appear in the Log window.
If I add the
SetApplicationAttribute(android:largeHeap,"true")
line to the Manifest, there is an improvement, but the "downsampling image" status lines start appearing after the sixth orientation change.
On my Nexus 10 Tablet, the downsampling of images never seems to occur, (or at least it is more than 50 orientation changes -- I stopped at 51). Why is there a difference between the smartphone and tablet?
According to this post:
https://www.b4x.com/android/forum/t...memory-used-imageviews-bitmaps.49597/#content
bitmaps get released on orientation changes and there should not be memory issues, even if the user rotates the device many times.
Why am I allowed to change the orientation once without downsampling (or 5 times with the largeHeap), but then the downsampling occurs? Is this only related to the bitmaps/storage? If the bitmap memory is released, why does this occur at all?
The images are directly for my own use to provide information to the user while playing the game -- they are not, say, large photos for which I would then use "LoadBitmapSample" to give a smaller representation of a larger image.
Several of my bitmaps do go to 1500x750 in size.
Is there any guide to what a maximum bitmap size should be? The downsampling seems to occur only after an aggregate amount of memory is used, but what goes into this aggregate summation of memory use?
I have tried re-sizing the larger bitmaps (about 7 images are 1500x750) by decreasing their size by 50%, and that does make an improvement -- I can rotate the device 7 times with the largeHeap used, with the downsampling occurring on the 8th rotation.
---------
Additional related question: when the downsampling does occur, the status lines typically occur in groups like this:
Downsampling image due to lack of memory.
Downsampling image due to lack of memory: 2
Downsampling image due to lack of memory: 4
Downsampling image due to lack of memory.
Downsampling image due to lack of memory: 2
Downsampling image due to lack of memory: 4
Downsampling image due to lack of memory: 8
Downsampling image due to lack of memory: 16
Downsampling image due to lack of memory: 32
In the example above, is the downsampling occurring on TWO images, with multiple downsamples occurring on each image depending on its size (3 times for the first image that downsamples to "4", and 6 times for the second image that downsamples to "32"? (If the Image Names were to be shown, I would then know which images I would need to make smaller to avoid the downsampling -- I have added this to the WishList).
If I add the
SetApplicationAttribute(android:largeHeap,"true")
line to the Manifest, there is an improvement, but the "downsampling image" status lines start appearing after the sixth orientation change.
On my Nexus 10 Tablet, the downsampling of images never seems to occur, (or at least it is more than 50 orientation changes -- I stopped at 51). Why is there a difference between the smartphone and tablet?
According to this post:
https://www.b4x.com/android/forum/t...memory-used-imageviews-bitmaps.49597/#content
bitmaps get released on orientation changes and there should not be memory issues, even if the user rotates the device many times.
Why am I allowed to change the orientation once without downsampling (or 5 times with the largeHeap), but then the downsampling occurs? Is this only related to the bitmaps/storage? If the bitmap memory is released, why does this occur at all?
The images are directly for my own use to provide information to the user while playing the game -- they are not, say, large photos for which I would then use "LoadBitmapSample" to give a smaller representation of a larger image.
Several of my bitmaps do go to 1500x750 in size.
Is there any guide to what a maximum bitmap size should be? The downsampling seems to occur only after an aggregate amount of memory is used, but what goes into this aggregate summation of memory use?
I have tried re-sizing the larger bitmaps (about 7 images are 1500x750) by decreasing their size by 50%, and that does make an improvement -- I can rotate the device 7 times with the largeHeap used, with the downsampling occurring on the 8th rotation.
---------
Additional related question: when the downsampling does occur, the status lines typically occur in groups like this:
Downsampling image due to lack of memory.
Downsampling image due to lack of memory: 2
Downsampling image due to lack of memory: 4
Downsampling image due to lack of memory.
Downsampling image due to lack of memory: 2
Downsampling image due to lack of memory: 4
Downsampling image due to lack of memory: 8
Downsampling image due to lack of memory: 16
Downsampling image due to lack of memory: 32
In the example above, is the downsampling occurring on TWO images, with multiple downsamples occurring on each image depending on its size (3 times for the first image that downsamples to "4", and 6 times for the second image that downsamples to "32"? (If the Image Names were to be shown, I would then know which images I would need to make smaller to avoid the downsampling -- I have added this to the WishList).
Last edited: