https://bugs.freedesktop.org/show_bug.cgi?id=62591
Priority: medium
Bug ID: 62591
Assignee: [email protected]
Summary: sdremote: frequent crashes ...
Severity: critical
Classification: Unclassified
OS: All
Reporter: [email protected]
Hardware: Other
Status: NEW
Version: 4.0.0.3 release
Component: Android Impress Remote
Product: LibreOffice
I did an hour long presentation and got this today:
E/AndroidRuntime( 2269): java.lang.OutOfMemoryError: bitmap size exceeds VM
budget
E/AndroidRuntime( 2269): at
android.graphics.BitmapFactory.nativeDecodeByteArray(Native Method)
E/AndroidRuntime( 2269): at
android.graphics.BitmapFactory.decodeByteArray(BitmapFactory.java:405)
E/AndroidRuntime( 2269): at
android.graphics.BitmapFactory.decodeByteArray(BitmapFactory.java:418)
E/AndroidRuntime( 2269): at
org.libreoffice.impressremote.communication.SlideShow.getImage(SlideShow.java:57)
E/AndroidRuntime( 2269): at
org.libreoffice.impressremote.PresentationFragment$ThumbnailAdapter.createBitmap(PresentationFragment.java:309)
E/AndroidRuntime( 2269): at
pl.polidea.coverflow.AbstractCoverFlowImageAdapter.getItem(AbstractCoverFlowImageAdapter.java:73)
I strongly suspect that this is because:
public Bitmap getImage(int aSlide) {
byte[] aImage = mPreviewImages.get(aSlide);
if (aImage == null) {
return BitmapFactory.decodeResource(mContext.getResources(),
R.drawable.image_loading);
}
Bitmap aBitmap = null;
try {
aBitmap = BitmapFactory.decodeByteArray(aImage, 0, aImage.length);
} catch (OutOfMemoryError e) {
Log.e(Globals.TAG, "Bitmap decoding error byte length: " +
aImage.length +
"first 4 bytes: " + aImage[0] + " " + aImage[1] + " " +
aImage[2] + " " + aImage[3] +
"Exception " + e);
}
if (aBitmap == null) {
return BitmapFactory.decodeResource(mContext.getResources(),
R.drawable.image_loading);
}
return aBitmap;
}
is called by the coverflow, and constantly re-creates the bitmap from the
stored base64 string.
It seems to me that this is really silly :-) we should store the Bitmap and
return the same Bitmap pointer for each slide as a Bitmap - which has to be 50%
of the size of a base64 encoded image. It would also be the same image each
time so as to not kill the GC etc. - and caching that should improve perf.
We should throw away the base64 text too as soon as we successfully have an
image in hand :-)
--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs