Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13664] Android: Garbage collection resulting in crash occurring when passing objects to Common JS modules

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionCannot Reproduce
Resolution Date2013-06-26T18:48:25.000+0000
Affected Version/sRelease 3.1.0
Fix Version/s2013 Sprint 13 Core, 2013 Sprint 13
ComponentsAndroid
Labelsparity, triage
ReporterDaniel Sefton
AssigneeMatt Langston
Created2013-04-24T00:28:37.000+0000
Updated2017-03-21T21:36:09.000+0000

Description

*Problem description* Garbage collection is occurring when it shouldn't be on Android only (see test case). There could be a conflict between JavaScript and Java's garbage collection mechanisms. *Steps to reproduce* 1. Run attached project on Android device 2. Tap "Click to get to screen" 3. Wait 20 (or more) seconds 4. Tap "Wait 20 seconds" button 5. Observe crash *Test case* See attached project.

Attachments

FileDateSize
compositecrash.zip2013-04-24T00:28:37.000+00002898024

Comments

  1. Ingo Muschenetz 2013-04-25

    Possible workaround: declaring 2DMatrix *outside* the View2 constructor doesn't cause crash. That way we can call the method without changing scope of the variable.
       var transform = Ti.UI.create2DMatrix();
       function View2 (window) {
         btn.addEventListener('click', function(){
           image.transform = transform;
         });
       }
       
    So right now, as per our understanding, only following scope causes the crash.
       function View2 (window) {
       var transform = Ti.UI.create2DMatrix();
         btn.addEventListener('click', function(){
           image.transform = transform;
         });
       }
       
  2. Brian Lonsdorf 2013-04-26

    Second work around. Declare the 2DMatrix within the click handler and it will not crash. This is not limited to 2DMatrix. It has crashed on events, animations, etc.
  3. Brian Lonsdorf 2013-04-26

    Extra reproduction steps: 1. Tax the OS by opening a browser with lots of tabs. Open other apps. 2. Open the demo app 3. Wait a minute or two before clicking
  4. Brian Lonsdorf 2013-04-29

    04-26 11:00:12.330 143 288 D SurfaceFlinger: About to give-up screen, flinger = 0x412d1af0 04-26 11:00:15.659 308 357 I WindowManager: No lock screen! 04-26 11:00:15.760 9834 9834 I TiRootActivity: (main) [0,0] checkpoint, on root activity resume. activity = com.lanica.compositecrash.CompositecrashActivity@4136ec68 04-26 11:00:15.770 143 288 D SurfaceFlinger: Screen about to return, flinger = 0x412d1af0 04-26 11:00:18.180 9834 9849 F libc : Fatal signal 11 (SIGSEGV) at 0x0000000c (code=1), thread 9849 (KrollRuntimeThr) 04-26 11:00:18.280 142 142 I DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 04-26 11:00:18.280 142 142 I DEBUG : Build fingerprint: 'motorola/tervigon/wingray:4.1.1/JRO03H/405518:user/release-keys' 04-26 11:00:18.280 142 142 I DEBUG : pid: 9834, tid: 9849, name: KrollRuntimeThr >>> com.lanica.compositecrash <<< 04-26 11:00:18.280 142 142 I DEBUG : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0000000c 04-26 11:00:18.370 142 142 I DEBUG : r0 00000000 r1 5e2759a0 r2 000000aa r3 00000001 04-26 11:00:18.370 142 142 I DEBUG : r4 00000000 r5 5c524db8 r6 510f16fc r7 00000000 04-26 11:00:18.370 142 142 I DEBUG : r8 5ddf57ff r9 5c525418 sl 510f16fc fp 510f1700 04-26 11:00:18.370 142 142 I DEBUG : ip 5e33ef10 sp 5ddf5798 lr 5de65f5b pc 5de65d7c cpsr 400f0030 04-26 11:00:18.370 142 142 I DEBUG : d0 4083e80000000000 d1 bff000004326aaab 04-26 11:00:18.370 142 142 I DEBUG : d2 40f86a0000000000 d3 414e848000000000 04-26 11:00:18.370 142 142 I DEBUG : d4 4008000000000000 d5 4050800000000000 04-26 11:00:18.370 142 142 I DEBUG : d6 0000001d00000000 d7 0000001d00000000 04-26 11:00:18.370 142 142 I DEBUG : d8 0000000000000000 d9 0000000000000000 04-26 11:00:18.370 142 142 I DEBUG : d10 0000000000000000 d11 0000000000000000 04-26 11:00:18.370 142 142 I DEBUG : d12 0000000000000000 d13 0000000000000000 04-26 11:00:18.370 142 142 I DEBUG : d14 0000000000000000 d15 0000000000000000 04-26 11:00:18.370 142 142 I DEBUG : scr 60000011 04-26 11:00:18.380 142 142 I DEBUG : 04-26 11:00:18.380 142 142 I DEBUG : backtrace: 04-26 11:00:18.380 142 142 I DEBUG : #00 pc 0006fd7c /data/data/com.lanica.compositecrash/lib/libkroll-v8.so (titanium::EventEmitter::~EventEmitter()+71) 04-26 11:00:18.380 142 142 I DEBUG : #01 pc 0006ff57 /data/data/com.lanica.compositecrash/lib/libkroll-v8.so (titanium::JavaObject::getJavaObject()+58) 04-26 11:00:18.380 142 142 I DEBUG : #02 pc 000758f3 /data/data/com.lanica.compositecrash/lib/libkroll-v8.so (titanium::TypeConverter::jsValueToJavaObject(v8::Local, bool*)+306) 04-26 11:00:18.380 142 142 I DEBUG : #03 pc 00073b65 /data/data/com.lanica.compositecrash/lib/libkroll-v8.so 04-26 11:00:18.380 142 142 I DEBUG : #04 pc 00073c63 /data/data/com.lanica.compositecrash/lib/libkroll-v8.so (titanium::Proxy::onPropertyChanged(v8::Local, v8::Local, v8::AccessorInfo const&)+6) 04-26 11:00:18.380 142 142 I DEBUG : #05 pc 0025b7e4 /data/data/com.lanica.compositecrash/lib/libkroll-v8.so 04-26 11:00:18.380 142 142 I DEBUG : #06 pc 000a9b3b 04-26 11:00:18.380 142 142 I DEBUG : 04-26 11:00:18.380 142 142 I DEBUG : stack: 04-26 11:00:18.380 142 142 I DEBUG : 5ddf5758 5c54d008 04-26 11:00:18.380 142 142 I DEBUG : 5ddf575c 00000009 04-26 11:00:18.380 142 142 I DEBUG : 5ddf5760 5720acf0 04-26 11:00:18.380 142 142 I DEBUG : 5ddf5764 510f16fc 04-26 11:00:18.380 142 142 I DEBUG : 5ddf5768 510f1700 04-26 11:00:18.380 142 142 I DEBUG : 5ddf576c 4089536f /system/lib/libdvm.so (dvmCreateStringFromUnicode(unsigned short const*, int)+18) 04-26 11:00:18.380 142 142 I DEBUG : 5ddf5770 41058008 04-26 11:00:18.380 142 142 I DEBUG : 5ddf5774 5ddf57d8 04-26 11:00:18.380 142 142 I DEBUG : 5ddf5778 00001000 04-26 11:00:18.380 142 142 I DEBUG : 5ddf577c 5ddf57d8 04-26 11:00:18.380 142 142 I DEBUG : 5ddf5780 414be940 /dev/ashmem/dalvik-heap (deleted) 04-26 11:00:18.380 142 142 I DEBUG : 5ddf5784 510f16fc 04-26 11:00:18.380 142 142 I DEBUG : 5ddf5788 510f1700 04-26 11:00:18.380 142 142 I DEBUG : 5ddf578c 400eef23 /system/lib/libc.so (dlfree+338) 04-26 11:00:18.380 142 142 I DEBUG : 5ddf5790 df0027ad 04-26 11:00:18.380 142 142 I DEBUG : 5ddf5794 00000000 04-26 11:00:18.380 142 142 I DEBUG : #00 5ddf5798 5e33ee30 /data/data/com.lanica.compositecrash/lib/libkroll-v8.so 04-26 11:00:18.380 142 142 I DEBUG : ........ ........ 04-26 11:00:18.380 142 142 I DEBUG : #01 5ddf5798 5e33ee30 /data/data/com.lanica.compositecrash/lib/libkroll-v8.so 04-26 11:00:18.380 142 142 I DEBUG : 5ddf579c 5c524db8 04-26 11:00:18.380 142 142 I DEBUG : 5ddf57a0 510f16fc 04-26 11:00:18.380 142 142 I DEBUG : 5ddf57a4 5de6b8f7 /data/data/com.lanica.compositecrash/lib/libkroll-v8.so (titanium::TypeConverter::jsValueToJavaObject(v8::Local, bool*)+310) 04-26 11:00:18.380 142 142 I DEBUG : #02 5ddf57a8 5ddf57d8 04-26 11:00:18.380 142 142 I DEBUG : 5ddf57ac 400f08bd /system/lib/libc.so (free+12) 04-26 11:00:18.380 142 142 I DEBUG : 5ddf57b0 000002b3 04-26 11:00:18.380 142 142 I DEBUG : 5ddf57b4 5c2b0331 /data/data/com.lanica.compositecrash/lib/libstlport_shared.so (operator delete(void*)+8) 04-26 11:00:18.380 142 142 I DEBUG : 5ddf57b8 5ddf57d8 04-26 11:00:18.380 142 142 I DEBUG : 5ddf57bc 5c2b033b /data/data/com.lanica.compositecrash/lib/libstlport_shared.so (operator delete[](void*)+6) 04-26 11:00:18.380 142 142 I DEBUG : 5ddf57c0 5ddf57d8 04-26 11:00:18.380 142 142 I DEBUG : 5ddf57c4 5df22234 /data/data/com.lanica.compositecrash/lib/libkroll-v8.so (v8::String::Value::~Value()+24) 04-26 11:00:18.380 142 142 I DEBUG : 5ddf57c8 5ddf57d8 04-26 11:00:18.380 142 142 I DEBUG : 5ddf57cc 5c524db8 04-26 11:00:18.380 142 142 I DEBUG : 5ddf57d0 5ddf584c 04-26 11:00:18.380 142 142 I DEBUG : 5ddf57d4 510f16fc 04-26 11:00:18.380 142 142 I DEBUG : 5ddf57d8 510f1700 04-26 11:00:18.380 142 142 I DEBUG : 5ddf57dc 414be940 /dev/ashmem/dalvik-heap (deleted) 04-26 11:00:18.380 142 142 I DEBUG : 5ddf57e0 5c525418 04-26 11:00:18.380 142 142 I DEBUG : 5ddf57e4 5ddf5864 04-26 11:00:18.380 142 142 I DEBUG : ........ ........ 04-26 11:00:18.380 142 142 I DEBUG : 04-26 11:00:18.380 142 142 I DEBUG : memory near r1: 04-26 11:00:18.380 142 142 I DEBUG : 5e275980 646e6946 74736e49 65636e61 72506e49 FindInstanceInPr 04-26 11:00:18.380 142 142 I DEBUG : 5e275990 746f746f 43657079 6e696168 00002928 ototypeChain().. 04-26 11:00:18.380 142 142 I DEBUG : 5e2759a0 3a3a3876 656a624f 3a3a7463 65746e49 v8::Object::Inte 04-26 11:00:18.380 142 142 I DEBUG : 5e2759b0 6c616e72 6c656946 756f4364 2928746e rnalFieldCount() 04-26 11:00:18.380 142 142 I DEBUG : 5e2759c0 00000000 3a3a3876 656a624f 3a3a7463 ....v8::Object:: 04-26 11:00:18.380 142 142 I DEBUG : 04-26 11:00:18.380 142 142 I DEBUG : memory near r5: 04-26 11:00:18.380 142 142 I DEBUG : 5c524d98 40711d18 00000001 00000008 5c942798 ..q@.........'.\ 04-26 11:00:18.380 142 142 I DEBUG : 5c524da8 407f2cd9 00000000 00000020 0000002b .,.@.... ...+... 04-26 11:00:18.380 142 142 I DEBUG : 5c524db8 408fbdf0 00000000 0000000b 5c54d008 ...@..........T\ 04-26 11:00:18.380 142 142 I DEBUG : 5c524dc8 00000000 5d3fc5b0 5c9e34f8 65766900 ......?].4.\.ive 04-26 11:00:18.380 142 142 I DEBUG : 5c524dd8 00000028 0000002b 00000000 59a3f420 (...+....... ..Y 04-26 11:00:18.380 142 142 I DEBUG : 04-26 11:00:18.380 142 142 I DEBUG : memory near r6: 04-26 11:00:18.380 142 142 I DEBUG : 510f16dc 00000084 2bb28855 2bb542a1 2bb08091 ....U..+.B.+...+ 04-26 11:00:18.380 142 142 I DEBUG : 510f16ec 36827781 5e618ac1 3ba0a001 36827781 .w.6..a^...;.w.6 04-26 11:00:18.380 142 142 I DEBUG : 510f16fc 2bba9b3d 2d725b31 2bb28969 368486a1 =..+1[r-i..+...6 04-26 11:00:18.380 142 142 I DEBUG : 510f170c 2d70ba71 368276c1 2bb32db1 2bb08091 q.p-.v.6.-.+...+ 04-26 11:00:18.380 142 142 I DEBUG : 510f171c 2bb08091 3687dde1 5e61c961 3687dde1 ...+...6a.a^...6 04-26 11:00:18.380 142 142 I DEBUG : 04-26 11:00:18.380 142 142 I DEBUG : memory near r8: 04-26 11:00:18.380 142 142 I DEBUG : 5ddf57dc 414be940 5c525418 5ddf5864 510f1700 @.KA.TR\dX.]...Q 04-26 11:00:18.380 142 142 I DEBUG : 5ddf57ec 5de69b69 5ddf582c 5ddf5894 00000001 i..],X.].X.].... 04-26 11:00:18.380 142 142 I DEBUG : 5ddf57fc 00ba9c3d 41058008 510f16fc 510f26b0 =......A...Q.&.Q 04-26 11:00:18.380 142 142 I DEBUG : 5ddf580c 00000000 510f16fc 2bba7799 5ddf5864 .......Q.w.+dX.] 04-26 11:00:18.380 142 142 I DEBUG : 5ddf581c 5de69c67 41058008 5e0517e8 36836da0 g..]...A...^.m.6 04-26 11:00:18.380 142 142 I DEBUG : 04-26 11:00:18.380 142 142 I DEBUG : memory near r9: 04-26 11:00:18.380 142 142 I DEBUG : 5c5253f8 40261eb0 5cc79878 00000016 00000007 ..&@x..\........ 04-26 11:00:18.380 142 142 I DEBUG : 5c525408 00000002 00000000 006e0065 00000023 ........e.n.#... 04-26 11:00:18.380 142 142 I DEBUG : 5c525418 5e32e2d0 510e6cb8 00000000 1d200007 ..2^.l.Q...... . 04-26 11:00:18.380 142 142 I DEBUG : 5c525428 00000000 492e6901 6567616d 00000013 .....i.Image.... 04-26 11:00:18.380 142 142 I DEBUG : 5c525438 00050184 01040006 000a0b13 00000043 ............C... 04-26 11:00:18.380 142 142 I DEBUG : 04-26 11:00:18.380 142 142 I DEBUG : memory near sl: 04-26 11:00:18.380 142 142 I DEBUG : 510f16dc 00000084 2bb28855 2bb542a1 2bb08091 ....U..+.B.+...+ 04-26 11:00:18.380 142 142 I DEBUG : 510f16ec 36827781 5e618ac1 3ba0a001 36827781 .w.6..a^...;.w.6 04-26 11:00:18.380 142 142 I DEBUG : 510f16fc 2bba9b3d 2d725b31 2bb28969 368486a1 =..+1[r-i..+...6 04-26 11:00:18.380 142 142 I DEBUG : 510f170c 2d70ba71 368276c1 2bb32db1 2bb08091 q.p-.v.6.-.+...+ 04-26 11:00:18.380 142 142 I DEBUG : 510f171c 2bb08091 3687dde1 5e61c961 3687dde1 ...+...6a.a^...6 04-26 11:00:18.380 142 142 I DEBUG : 04-26 11:00:18.380 142 142 I DEBUG : memory near fp: 04-26 11:00:18.380 142 142 I DEBUG : 510f16e0 2bb28855 2bb542a1 2bb08091 36827781 U..+.B.+...+.w.6 04-26 11:00:18.380 142 142 I DEBUG : 510f16f0 5e618ac1 3ba0a001 36827781 2bba9b3d ..a^...;.w.6=..+ 04-26 11:00:18.380 142 142 I DEBUG : 510f1700 2d725b31 2bb28969 368486a1 2d70ba71 1[r-i..+...6q.p- 04-26 11:00:18.380 142 142 I DEBUG : 510f1710 368276c1 2bb32db1 2bb08091 2bb08091 .v.6.-.+...+...+ 04-26 11:00:18.380 142 142 I DEBUG : 510f1720 3687dde1 5e61c961 3687dde1 36897961 ...6a.a^...6ay.6 04-26 11:00:18.380 142 142 I DEBUG : 04-26 11:00:18.380 142 142 I DEBUG : memory near ip: 04-26 11:00:18.380 142 142 I DEBUG : 5e33eef0 40122465 5c2e9700 5c2e9ba8 40092248 e$.@...\...\H".@ 04-26 11:00:18.380 142 142 I DEBUG : 5e33ef00 4010b8b5 400d52bd 5c2b1384 400e5628 ...@.R.@..+\(V.@ 04-26 11:00:18.380 142 142 I DEBUG : 5e33ef10 400ec098 400e6368 400eb954 400f3771 ...@hc.@T..@q7.@ 04-26 11:00:18.380 142 142 I DEBUG : 5e33ef20 400f0a48 400f4e6d 5c2e97ac 400e62a4 H..@mN.@...\.b.@ 04-26 11:00:18.380 142 142 I DEBUG : 5e33ef30 400f581d 400f5671 4010d23d 40097258 .X.@qV.@=..@Xr.@ 04-26 11:00:18.380 142 142 I DEBUG : 04-26 11:00:18.380 142 142 I DEBUG : memory near sp: 04-26 11:00:18.380 142 142 I DEBUG : 5ddf5778 00001000 5ddf57d8 414be940 510f16fc .....W.]@.KA...Q 04-26 11:00:18.380 142 142 I DEBUG : 5ddf5788 510f1700 400eef23 df0027ad 00000000 ...Q#..@.'...... 04-26 11:00:18.380 142 142 I DEBUG : 5ddf5798 5e33ee30 5c524db8 510f16fc 5de6b8f7 0.3^.MR\...Q...] 04-26 11:00:18.380 142 142 I DEBUG : 5ddf57a8 5ddf57d8 400f08bd 000002b3 5c2b0331 .W.]...@....1.+\ 04-26 11:00:18.380 142 142 I DEBUG : 5ddf57b8 5ddf57d8 5c2b033b 5ddf57d8 5df22234 .W.];.+\.W.]4".] 04-26 11:00:18.380 142 142 I DEBUG : 04-26 11:00:18.380 142 142 I DEBUG : code around pc: 04-26 11:00:18.380 142 142 I DEBUG : 5de65d5c b1086860 eb6cf0bd 60632300 f7ff4620 h....l..#c F.. 04-26 11:00:18.380 142 142 I DEBUG : 5de65d6c 4620eb5a bf00bd70 004d90f4 000013bc Z. Fp.....M..... 04-26 11:00:18.380 142 142 I DEBUG : 5de65d7c b10b68c3 47707d00 2b006903 2001d1fa .h...}pG.i.+... 04-26 11:00:18.380 142 142 I DEBUG : 5de65d8c bf00e7f9 4604b510 b1114608 f0d44608 .......F.F...F.. 04-26 11:00:18.380 142 142 I DEBUG : 5de65d9c 6060e84a 46222100 ec4cf0c1 bf00bd10 J.`.!"F..L..... 04-26 11:00:18.380 142 142 I DEBUG : 04-26 11:00:18.380 142 142 I DEBUG : code around lr: 04-26 11:00:18.380 142 142 I DEBUG : 5de65f38 23004a11 46216860 447a7523 eb58f0bd .J.#h!F#uzD..X. 04-26 11:00:18.380 142 142 I DEBUG : 5de65f48 6900e003 fe6cf004 46284605 f7ffbd70 ...i..l..F(Fp... 04-26 11:00:18.380 142 142 I DEBUG : 5de65f58 b908ff11 e7f868e5 21004620 ffc6f7ff .....h.. F.!.... 04-26 11:00:18.380 142 142 I DEBUG : 5de65f68 e7f268e5 20064905 44794a05 f7ff447a .h...I. .JyDzD.. 04-26 11:00:18.380 142 142 I DEBUG : 5de65f78 e7ddeac0 004da884 ffffff5b 003c586a ......M.[...jX<. 04-26 11:00:18.490 308 346 I BootReceiver: Copying /data/tombstones/tombstone_09 to DropBox (SYSTEM_TOMBSTONE) 04-26 11:00:18.510 308 361 W InputDispatcher: channel '41568260 com.lanica.compositecrash/com.lanica.compositecrash.CompositecrashActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9 04-26 11:00:18.510 308 361 E InputDispatcher: channel '41568260 com.lanica.compositecrash/com.lanica.compositecrash.CompositecrashActivity (server)' ~ Channel is unrecoverably broken and will be disposed! 04-26 11:00:18.510 144 144 D Zygote : Process 9834 terminated by signal (11) 04-26 11:00:18.550 308 346 D dalvikvm: GC_FOR_ALLOC freed 710K, 42% free 10008K/16963K, paused 48ms, total 49ms 04-26 11:00:18.550 308 361 W InputDispatcher: Attempted to unregister already unregistered input channel '41568260 com.lanica.compositecrash/com.lanica.compositecrash.CompositecrashActivity (server)' 04-26 11:00:18.550 308 731 I ActivityManager: Process com.lanica.compositecrash (pid 9834) has died. 04-26 11:00:18.550 308 361 I WindowManager: WINDOW DIED Window{41568260 com.lanica.compositecrash/com.lanica.compositecrash.CompositecrashActivity paused=false} 04-26 11:00:18.550 308 731 W ActivityManager: Force removing ActivityRecord{4165a270 com.lanica.compositecrash/.CompositecrashActivity}: app died, no saved state 04-26 11:00:18.550 308 758 W WindowManager: Failed looking up window 04-26 11:00:18.550 308 758 W WindowManager: java.lang.IllegalArgumentException: Requested window android.os.BinderProxy@416c8940 does not exist 04-26 11:00:18.550 308 758 W WindowManager: at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:7664) 04-26 11:00:18.550 308 758 W WindowManager: at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:7655) 04-26 11:00:18.550 308 758 W WindowManager: at com.android.server.wm.WindowState$DeathRecipient.binderDied(WindowState.java:854) 04-26 11:00:18.550 308 758 W WindowManager: at android.os.BinderProxy.sendDeathNotice(Binder.java:449) 04-26 11:00:18.550 308 758 W WindowManager: at dalvik.system.NativeStart.run(Native Method) 04-26 11:00:18.550 308 758 I WindowState: WIN DEATH: null 04-26 11:00:18.570 308 674 W InputMethodManagerService: Got RemoteException sending setActive(false) notification to pid 9834 uid 10053 04-26 11:00:20.690 1796 1796 D dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 0ms 04-26 11:00:20.720 1796 1796 D dalvikvm: GC_EXPLICIT freed 96K, 70% free 5376K/17731K, paused 2ms+3ms, total 24ms ^[[A
  5. Joël Bohrer 2013-06-05

    Hi, We spent a whole day on this bug, and here is our conclusion.. The problem is about Javascript scope for Titanium objects. In the logs, the problem was clearly after a garbage collect, so, first of all, we created a small module called "androidgc" which simply launch Android garbage collector (not the V8 GC). You can find this module here : https://github.com/ChrOnOs83/TiModuleAndroidGC Then, we decided to use your files and made it as simple as possible. We finally got a unique app.js file with this content :
       function createView(){
       	  var view = Ti.UI.createView({backgroundColor: 'white'});
         
       	  var gc = Ti.UI.createButton({top: '10dp',title: "First, click here many time quickly (cause GC)"});
       	  var btn = Ti.UI.createButton({title: "Next, click here"});
       	  var label = Ti.UI.createLabel({text: 'Hello World', bottom: '10dp'});
       	  
       	  view.add(btn);
       	  view.add(gc);
       	  
       	  btn.addEventListener('click', function(){
       		  view.add(label);
       	  });
       	  
       	  var androidgc = require('ti.nartex.androidgc');
       	  gc.addEventListener('click', function(){
       		androidgc.gc();
       	  });
       	  
       	  return view;
       }
       
       
       var win = Ti.UI.createWindow({});
       win.open();
       
       var view = createView();
       win.add(view);
       
    When you run this code on your Android Device, you should press many times on the "GC" button, because garbage collector may not clean your ressources each time... If GC has be done correctly, the second button press will fail, because the label is not here anymore. If you add the label to the view, and then change its title, no problem If you create the label in the event listener, no problem *If you makes a reference to a global variable (without the _var_ keyword for example), it works* If you put the function in a CommonJS module, the same rules apply. So... Titanium objects created in a function (all the Ti.something) may be killed by garbage collector at any time if they are not attached to a view/window, or declared as global var. It breaks the Javascript scope pattern...
  6. Joël Bohrer 2013-06-05

    And the problem exists also in SDK 2.3 and 3.0
  7. Allen Yeung 2013-06-26

  8. Allen Yeung 2013-06-26

    Marking as cannot reproduce for the original test case.
  9. Lee Morris 2017-03-21

    Closing ticket as the issue cannot be reproduced and due to the above comments.

JSON Source