Uploaded image for project: 'Appcelerator Modules'
  1. Appcelerator Modules
  2. MOD-2378

Android: Memory leak - TiBlob: (main) getNativePath not supported for non-file blob types.

    Details

    • Story Points:
      5

      Description

      Adding annotation with customView to a map outputs this warning for every annotation. This blocks the performance when you have 70+ markers.

      TiBlob: (main) [1106,1935] getNativePath not supported for non-file blob types.

      To reproduce, just do this in your map complete event handler:

      function onMapComplete(event) {
      	var annot = TI_MAP.createAnnotation({
      		latitude: 41.071004,
      		longitude: 29.015450,
      		title: 'test #1',
      		customView: Ti.UI.createImageView({
      			image: '/images/marker.png',
      			width: Ti.UI.SIZE,
      			height: Ti.UI.SIZE
      		})
      	});
      	$.mapView.addAnnotation(annot);
      }
      

      Here is the line in TiBlob.java. `getNativePath()` should not be called in the first place bec. customView already provides the annotation view. Why would it try to get a path for it?

      Why I use customView? Bec. otherwise if I use the image property, it leaks memory on Android; if you remove and re-add annotations multiple times... I'm tired of Titanium!

      UPDATE 1: It still leaks memory both when `.image` or `.customView` used. Doesn't matter.
      UPDATE 2: It also leaks memory when using default pins (not setting `.image` or `.customView`) but the app stands a bit more longer before it crashes.

      [WARN] :   art: Throwing OutOfMemoryError "Failed to allocate a 57612 byte allocation with 55816 free bytes and 54KB until OOM"
      [WARN] :   JNIHelp: Discarding pending exception (java.lang.OutOfMemoryError: Failed to allocate a 57612 byte allocation with 55816 free bytes and 54KB until OOM) to throw java/lang/RuntimeException
      [WARN] :   W/System.err: java.lang.RuntimeException: Could not allocate java pixel ref.
      [WARN] :   W/System.err: 	at android.graphics.Bitmap.nativeCreateFromParcel(Native Method)
      [WARN] :   W/System.err: 	at android.graphics.Bitmap.-wrap0(Bitmap.java)
      [WARN] :   W/System.err: 	at android.graphics.Bitmap$1.createFromParcel(Bitmap.java:1564)
      [WARN] :   W/System.err: 	at android.graphics.Bitmap$1.createFromParcel(Bitmap.java:1563)
      [WARN] :   W/System.err: 	at bsb.a(:com.google.android.gms@11509470:2)
      [WARN] :   W/System.err: 	at wpl.onTransact(:com.google.android.gms@11509470:8)
      [WARN] :   W/System.err: 	at android.os.Binder.transact(Binder.java:499)
      [WARN] :   W/System.err: 	at com.google.android.gms.internal.zzed.zza(Unknown Source)
      [WARN] :   W/System.err: 	at com.google.android.gms.maps.model.internal.zzc.zzd(Unknown Source)
      [WARN] :   W/System.err: 	at com.google.android.gms.maps.model.BitmapDescriptorFactory.fromBitmap(Unknown Source)
      [WARN] :   W/System.err: 	at ti.map.AnnotationProxy.handleImage(AnnotationProxy.java:272)
      [WARN] :   W/System.err: 	at ti.map.AnnotationProxy.processOptions(AnnotationProxy.java:232)
      [WARN] :   W/System.err: 	at ti.map.TiUIMapView.addAnnotation(TiUIMapView.java:438)
      [WARN] :   W/System.err: 	at ti.map.ViewProxy.handleAddAnnotation(ViewProxy.java:282)
      [WARN] :   W/System.err: 	at ti.map.ViewProxy.handleAddAnnotations(ViewProxy.java:325)
      [WARN] :   W/System.err: 	at ti.map.ViewProxy.addAnnotations(ViewProxy.java:313)
      [WARN] :   W/System.err: 	at org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method)
      [WARN] :   W/System.err: 	at org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:62)
      [WARN] :   W/System.err: 	at org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:934)
      [WARN] :   W/System.err: 	at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1157)
      [INFO] :   art: Waiting for a blocking GC Alloc
      [INFO] :   art: Starting a blocking GC Alloc
      [WARN] :   W/System.err: 	at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:363)
      [WARN] :   W/System.err: 	at android.os.Handler.dispatchMessage(Handler.java:98)
      [WARN] :   W/System.err: 	at android.os.Looper.loop(Looper.java:154)
      [WARN] :   W/System.err: 	at android.app.ActivityThread.main(ActivityThread.java:6119)
      [WARN] :   W/System.err: 	at java.lang.reflect.Method.invoke(Native Method)
      [WARN] :   W/System.err: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
      [WARN] :   W/System.err: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
      [ERROR] :  TiExceptionHandler: (main) [6051,31629] ----- Titanium Javascript Runtime Error -----
      [ERROR] :  TiExceptionHandler: (main) [0,31629] - In /alloy/controllers/index.js:101,13
      [ERROR] :  TiExceptionHandler: (main) [0,31629] - Message: Uncaught Could not allocate java pixel ref.
      [ERROR] :  TiExceptionHandler: (main) [0,31629] - Source: 				$.vwMap.addAnnotations(annots);
      [INFO] :   art: Waiting for a blocking GC Alloc
      [INFO] :   art: Clamp target GC heap from 111MB to 96MB
      [INFO] :   art: WaitForGcToComplete blocked for 21.152ms for cause Alloc
      [INFO] :   art: Starting a blocking GC Alloc
      [INFO] :   art: Waiting for a blocking GC Alloc
      [INFO] :   art: Clamp target GC heap from 111MB to 96MB
      [INFO] :   art: WaitForGcToComplete blocked for 16.867ms for cause Alloc
      [INFO] :   art: Starting a blocking GC Alloc
      [INFO] :   art: Waiting for a blocking GC Alloc
      [INFO] :   art: Starting a blocking GC Alloc
      [INFO] :   art: Waiting for a blocking GC Alloc
      [INFO] :   art: Clamp target GC heap from 111MB to 96MB
      [INFO] :   art: WaitForGcToComplete blocked for 21.218ms for cause Alloc
      [INFO] :   art: Starting a blocking GC Alloc
      [ERROR] :  V8Exception: Exception occurred at /alloy/controllers/index.js:101: Uncaught Could not allocate java pixel ref.
      [ERROR] :  V8Exception: Could not allocate java pixel ref.
      [INFO] :   Choreographer: Skipped 83 frames!  The application may be doing too much work on its main thread.
      [INFO] :   art: Waiting for a blocking GC Alloc
      [INFO] :   art: Waiting for a blocking GC Alloc
      [INFO] :   art: Waiting for a blocking GC Alloc
      [INFO] :   art: Clamp target GC heap from 111MB to 96MB
      [INFO] :   art: WaitForGcToComplete blocked for 15.277ms for cause Alloc
      [INFO] :   art: Starting a blocking GC Alloc
      [INFO] :   art: Starting a blocking GC Alloc
      [INFO] :   art: Starting a blocking GC Alloc
      [INFO] :   art: Waiting for a blocking GC Alloc
      [INFO] :   art: Starting a blocking GC Alloc
      [INFO] :   art: Waiting for a blocking GC Alloc
      [INFO] :   art: Waiting for a blocking GC Alloc
      [ERROR] :  EGL_emulation: tid 29011: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH)
      [WARN] :   OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xcb0fc420, error=EGL_BAD_MATCH
      [INFO] :   art: Clamp target GC heap from 111MB to 96MB
      [INFO] :   art: WaitForGcToComplete blocked for 35.539ms for cause Alloc
      [INFO] :   art: Starting a blocking GC Alloc
      [INFO] :   art: WaitForGcToComplete blocked for 24.297ms for cause Alloc
      [INFO] :   art: Starting a blocking GC Alloc
      [INFO] :   art: Starting a blocking GC Alloc
      [INFO] :   art: Starting a blocking GC Alloc
      [INFO] :   art: Waiting for a blocking GC Alloc
      [INFO] :   art: Starting a blocking GC Alloc
      [INFO] :   art: Waiting for a blocking GC Alloc
      [INFO] :   art: Clamp target GC heap from 111MB to 96MB
      [INFO] :   art: Alloc partial concurrent mark sweep GC freed 67(2456B) AllocSpace objects, 0(0B) LOS objects, 0% free, 95MB/96MB, paused 357us total 21.130ms
      [INFO] :   art: Starting a blocking GC Alloc
      [INFO] :   art: Waiting for a blocking GC Alloc
      [INFO] :   art: Clamp target GC heap from 111MB to 96MB
      [INFO] :   art: Alloc concurrent mark sweep GC freed 3(72B) AllocSpace objects, 0(0B) LOS objects, 0% free, 95MB/96MB, paused 261us total 21.652ms
      [INFO] :   art: Forcing collection of SoftReferences for 64KB allocation
      [INFO] :   art: Starting a blocking GC Alloc
      [INFO] :   art: Waiting for a blocking GC Alloc
      [INFO] :   art: Clamp target GC heap from 111MB to 96MB
      [INFO] :   art: Alloc concurrent mark sweep GC freed 3(72B) AllocSpace objects, 0(0B) LOS objects, 0% free, 95MB/96MB, paused 235us total 21.648ms
      [WARN] :   art: Throwing OutOfMemoryError "Failed to allocate a 65548 byte allocation with 32104 free bytes and 31KB until OOM"
      [INFO] :   art: WaitForGcToComplete blocked for 68.092ms for cause Alloc
      [INFO] :   art: Starting a blocking GC Alloc
      [INFO] :   art: WaitForGcToComplete blocked for 67.564ms for cause Background
      [INFO] :   art: Starting a blocking GC Alloc
      [INFO] :   art: Starting a blocking GC Alloc
      [INFO] :   art: Waiting for a blocking GC Alloc
      [INFO] :   art: Starting a blocking GC Alloc
      [INFO] :   art: Waiting for a blocking GC Alloc
      [INFO] :   art: Clamp target GC heap from 109MB to 96MB
      [INFO] :   art: Alloc partial concurrent mark sweep GC freed 3632(322KB) AllocSpace objects, 29(1740KB) LOS objects, 2% free, 93MB/96MB, paused 199us total 19.395ms
      [INFO] :   art: WaitForGcToComplete blocked for 21.957ms for cause Alloc
      [INFO] :   art: Starting a blocking GC Alloc
      [INFO] :   art: WaitForGcToComplete blocked for 18.575ms for cause Background
      [INFO] :   APSAnalyticsService: Analytics Service Started
      [INFO] :   APSAnalyticsService: Stopping Analytics Service
      

      Environment:
      macOS High Sierra, node 8.9.3, Ti SDK 7.0.0, javac 1.8.0_112
      Last Android device tested: Samsung Galaxy S7, Android 7.1.0 (API 25)

        Attachments

        1. map-annot-test.zip
          9.57 MB
        2. mleak-app-screen.png
          mleak-app-screen.png
          866 kB
        3. mleak-full-logs.txt.zip
          29 kB
        4. marker.png
          marker.png
          5 kB

          Activity

            People

            • Assignee:
              gmathews Gary Mathews
              Reporter:
              onury Onur Yıldırım
              Reviewer:
              Joshua Quick
            • Watchers:
              11 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Git Source Code