java.lang.OutOfMemoryError

Appcelerator JIRA | Mauro Parra-Miranda | 3 years ago
  1. 0

    h4. Problem Description When using the imageAsResize function in blob, it will start eventually to fail with a warning message about no more memory available. h4. Test Code {code} var count = 0; var win = Ti.UI.createWindow({ backgroundImage : 'b1.png', layout : 'vertical' }); var closeBtn = Ti.UI.createButton({ title : 'close', top : '44dp', }); var resizeBtn = Ti.UI.createButton({ title : 'resize: ' + count, top : '20dp', }); var imageView = Ti.UI.createImageView({ width : '200dp', height : '200dp', }); //-- win.add(closeBtn); win.add(resizeBtn); win.add(imageView); //-- resizeBtn.addEventListener('click', function() { var f = Ti.Filesystem.getFile('b1.jpg'); var blob = f.read(); f = null; win.remove(imageView); imageView.view = null; imageView = null; imageView = Ti.UI.createImageView({ width : '200dp', height : '200dp', }); imageView.image = blob.imageAsResized(960, 960); blob = null; win.add(imageView); count++; resizeBtn.title = 'resize: ' + count; }); closeBtn.addEventListener('click', function() { win.close(); }); win.open(); {code} h4. Attachments Check the attachments for b1.jpg h4. Steps to reproduce 1. Create mobile project (classic titanium) 2. Copy-Paste the code from the testcase into app.js 3. Copy bg1.jpg into Resources directory 4. Deploy into device 5. Click in resize until the image doesn't appear anymore. h4. Extra info when the image doesn't appear anymore, you will see a message in the console saying: {code} [ERROR] : TiBlob: (KrollRuntimeThread) [3227,231234] Unable to resize the image. Not enough memory: null [ERROR] : TiBlob: java.lang.OutOfMemoryError [ERROR] : TiBlob: at android.graphics.Bitmap.nativeCreate(Native Method) [ERROR] : TiBlob: at android.graphics.Bitmap.createBitmap(Bitmap.java:809) [ERROR] : TiBlob: at android.graphics.Bitmap.createBitmap(Bitmap.java:786) [ERROR] : TiBlob: at android.graphics.Bitmap.createBitmap(Bitmap.java:718) [ERROR] : TiBlob: at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:594) [ERROR] : TiBlob: at org.appcelerator.titanium.TiBlob.imageAsResized(TiBlob.java:543) [ERROR] : TiBlob: at org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method) [ERROR] : TiBlob: at org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:64) [ERROR] : TiBlob: at org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:884) [ERROR] : TiBlob: at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1107) [ERROR] : TiBlob: at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:327) [ERROR] : TiBlob: at android.os.Handler.dispatchMessage(Handler.java:98) [ERROR] : TiBlob: at android.os.Looper.loop(Looper.java:136) [ERROR] : TiBlob: at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112) [INFO] : I/dalvikvm-heap: Grow heap (frag case) to 182.277MB for 1474561 {code} h4. Q&A Link http://developer.appcelerator.com/question/162431/android-memory-leaks

    Appcelerator JIRA | 3 years ago | Mauro Parra-Miranda
    java.lang.OutOfMemoryError
  2. 0

    h4. Problem Description When using the imageAsResize function in blob, it will start eventually to fail with a warning message about no more memory available. h4. Test Code {code} var count = 0; var win = Ti.UI.createWindow({ backgroundImage : 'b1.png', layout : 'vertical' }); var closeBtn = Ti.UI.createButton({ title : 'close', top : '44dp', }); var resizeBtn = Ti.UI.createButton({ title : 'resize: ' + count, top : '20dp', }); var imageView = Ti.UI.createImageView({ width : '200dp', height : '200dp', }); //-- win.add(closeBtn); win.add(resizeBtn); win.add(imageView); //-- resizeBtn.addEventListener('click', function() { var f = Ti.Filesystem.getFile('b1.jpg'); var blob = f.read(); f = null; win.remove(imageView); imageView.view = null; imageView = null; imageView = Ti.UI.createImageView({ width : '200dp', height : '200dp', }); imageView.image = blob.imageAsResized(960, 960); blob = null; win.add(imageView); count++; resizeBtn.title = 'resize: ' + count; }); closeBtn.addEventListener('click', function() { win.close(); }); win.open(); {code} h4. Attachments Check the attachments for b1.jpg h4. Steps to reproduce 1. Create mobile project (classic titanium) 2. Copy-Paste the code from the testcase into app.js 3. Copy bg1.jpg into Resources directory 4. Deploy into device 5. Click in resize until the image doesn't appear anymore. h4. Extra info when the image doesn't appear anymore, you will see a message in the console saying: {code} [ERROR] : TiBlob: (KrollRuntimeThread) [3227,231234] Unable to resize the image. Not enough memory: null [ERROR] : TiBlob: java.lang.OutOfMemoryError [ERROR] : TiBlob: at android.graphics.Bitmap.nativeCreate(Native Method) [ERROR] : TiBlob: at android.graphics.Bitmap.createBitmap(Bitmap.java:809) [ERROR] : TiBlob: at android.graphics.Bitmap.createBitmap(Bitmap.java:786) [ERROR] : TiBlob: at android.graphics.Bitmap.createBitmap(Bitmap.java:718) [ERROR] : TiBlob: at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:594) [ERROR] : TiBlob: at org.appcelerator.titanium.TiBlob.imageAsResized(TiBlob.java:543) [ERROR] : TiBlob: at org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method) [ERROR] : TiBlob: at org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:64) [ERROR] : TiBlob: at org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:884) [ERROR] : TiBlob: at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1107) [ERROR] : TiBlob: at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:327) [ERROR] : TiBlob: at android.os.Handler.dispatchMessage(Handler.java:98) [ERROR] : TiBlob: at android.os.Looper.loop(Looper.java:136) [ERROR] : TiBlob: at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112) [INFO] : I/dalvikvm-heap: Grow heap (frag case) to 182.277MB for 1474561 {code} h4. Q&A Link http://developer.appcelerator.com/question/162431/android-memory-leaks

    Appcelerator JIRA | 3 years ago | Mauro Parra-Miranda
    java.lang.OutOfMemoryError
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

    2 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.OutOfMemoryError

      No message provided

      at android.graphics.Bitmap.nativeCreate()
    2. Android Platform
      Bitmap.createScaledBitmap
      1. android.graphics.Bitmap.nativeCreate(Native Method)
      2. android.graphics.Bitmap.createBitmap(Bitmap.java:809)
      3. android.graphics.Bitmap.createBitmap(Bitmap.java:786)
      4. android.graphics.Bitmap.createBitmap(Bitmap.java:718)
      5. android.graphics.Bitmap.createScaledBitmap(Bitmap.java:594)
      5 frames
    3. org.appcelerator.titanium
      TiBlob.imageAsResized
      1. org.appcelerator.titanium.TiBlob.imageAsResized(TiBlob.java:543)
      1 frame
    4. org.appcelerator.kroll
      KrollProxy.handleMessage
      1. org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method)
      2. org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:64)
      3. org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:884)
      4. org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1107)
      4 frames
    5. org.appcelerator.titanium
      TiViewProxy.handleMessage
      1. org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:327)
      1 frame
    6. Android Platform
      Looper.loop
      1. android.os.Handler.dispatchMessage(Handler.java:98)
      2. android.os.Looper.loop(Looper.java:136)
      2 frames
    7. org.appcelerator.kroll
      KrollRuntime$KrollRuntimeThread.run
      1. org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112)
      1 frame