[TIMOB-23218] Android: OutOfMemoryError in ImageView.toBlob
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2019-11-19T18:48:40.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Android |
Labels | Android, Android5, Android6.0, ImageView, OutOfMemory, engTriage, toBlob |
Reporter | Andrey Tkachenko |
Assignee | Unknown |
Created | 2016-04-08T06:06:38.000+0000 |
Updated | 2019-11-19T18:48:40.000+0000 |
Description
I got OutOfMemory with this code.
Steps to reproduce:
1. Create default Alloy project
2. Load and save big image to the assets
3. Add this test code to the click event handler
4. Click several times to the view with click event attached
5. See result in log
Image: https://static.pexels.com/photos/479/landscape-nature-sunset-trees.jpg
var iv = Ti.UI.createImageView({
width : Ti.UI.SIZE,
height : Ti.UI.SIZE,
image : '/images/landscape-nature-sunset-trees.jpg'
});
var blob = iv.toBlob();
iv.image = null;
iv = null;
Ti.API.info('OK!');
[ERROR] TiDrawableReference: (KrollRuntimeThread) [6078,6078] Unable to load bitmap. Not enough memory: Failed to allocate a 23887884 byte allocation with 8219096 free bytes and 7MB until OOM
[ERROR] TiDrawableReference: java.lang.OutOfMemoryError: Failed to allocate a 23887884 byte allocation with 8219096 free bytes and 7MB until OOM
[ERROR] TiDrawableReference: at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
[ERROR] TiDrawableReference: at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
[ERROR] TiDrawableReference: at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:609)
[ERROR] TiDrawableReference: at org.appcelerator.titanium.view.TiDrawableReference.getBitmap(TiDrawableReference.java:348)
[ERROR] TiDrawableReference: at org.appcelerator.titanium.view.TiDrawableReference.getBitmap(TiDrawableReference.java:300)
[ERROR] TiDrawableReference: at ti.modules.titanium.ui.widget.TiUIImageView.toBlob(TiUIImageView.java:947)
[ERROR] TiDrawableReference: at ti.modules.titanium.ui.ImageViewProxy.toBlob(ImageViewProxy.java:93)
[ERROR] TiDrawableReference: at org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method)
[ERROR] TiDrawableReference: at org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:62)
[ERROR] TiDrawableReference: at org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:918)
[ERROR] TiDrawableReference: at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1141)
[ERROR] TiDrawableReference: at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:356)
[ERROR] TiDrawableReference: at android.os.Handler.dispatchMessage(Handler.java:98)
[ERROR] TiDrawableReference: at android.os.Looper.loop(Looper.java:148)
[ERROR] TiDrawableReference: at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:118)
Hello, I am unable to reproduce this issue on Nexus 7 using the sample code and given steps. I tried with sdk 5.2.2.GA and 5.4.0 but got same result. I used the given image for testing. My index.js file is as follows.
After building the app when I clicked the view several times at once the following console log is produced. *Console Log:*
*Environment*: *Device info:* Nexux7 (android 6.0.1) *Node.js Version:* 0.12.7 *npm Version:* 2.11.3 *Titanium SDKs:* 5.2.2.GA and 5.2.1.GA *Java Development Kit Version:* 1.8.0_73 *Titanium CLI Version:* 5.0.5 *Appcelerator CLI Version:* 5.2.2 *Appcelerator Studio:* 4.4.0.201511241829
Can be reviewed?
@Nazmus Salahin can you try in genymotion emulator?
I get the same thing in Genymotion emulator and on pretty much any x86 device (tried 3 different ones)
Closing issue as “Cannot Reproduce”. Although the URL links is no longer available we tested with a large image. Axway Appcelerator Studio, build: 5.1.4.201909061933 macOS : 10.15 Node.js Version : 8.9.1 npm Version : 5.5.1 Appcelerator CLI : 7.1.1 Titanium CLI CLI Version : 5.2.1 node-appc Version : 0.2.49 Titanium SDKs : 8.2.1.GA