Possible leak on native maps

427 views
Skip to first unread message

Carlos Verdier

unread,
May 25, 2017, 9:25:51 AM5/25/17
to CodenameOne Discussions
Hi

Are you guys experiencing any problems with native maps? I get a crash consistently after opening and closing a form containing a native map several times. It happens on a iPad and a Android phone too. The last one is a powerful device, so it takes 28 times to crash with a OOM, always 28.

I haven't investigated any further, so I can't give any details by now, but I thought it was worth it mentioning in case anyone else is having the same problem.

Thanks.

Shai Almog

unread,
May 26, 2017, 12:30:24 AM5/26/17
to CodenameOne Discussions
Hi,
not getting it but OOM's are pretty hard to catch normally. I suggest using a profiler on the desktop to make sure you don't have a memory leak in the Java side just to be 100% safe. Normally log output for OOM's  isn't exactly helpful but it might provide some details.

Since the crash is portable both to Android and iOS I'm guessing it's somewhere in the Java code which means you should be able to see it on the simulator as constantly growing memory.

Carlos Verdier

unread,
May 26, 2017, 5:15:07 AM5/26/17
to CodenameOne Discussions
This simple code reproduces the problem. Just go back and forth and, eventually the app crash with OOM error. It took me 34 times with this code to crash.

    public void start() {
        if(current != null){
            current.show();
            return;
        }
        Form hi = new Form("Map Test", new BorderLayout(BorderLayout.CENTER_BEHAVIOR_CENTER_ABSOLUTE));
        Button btn = new Button("Show Map");
        hi.add(BorderLayout.CENTER, btn);        
        hi.show();
        Command back = new Command("Back") {
            @Override
            public void actionPerformed(ActionEvent evt) {
                hi.showBack();
            }            
        };        
        btn.addActionListener((evt) -> {
            Form hi2 = new Form("Map show", new BorderLayout());
            hi2.getToolbar().addCommandToLeftBar(back);
            hi2.setBackCommand(back);
            MapContainer map = new MapContainer(MAP_KEY);
            hi2.add(BorderLayout.CENTER, map);
            hi2.show();        
        });
    }


 I was lucky to get a stack trace only once, not from this code but from the actual program:

[EDT] 0:3:12,363 - Exception: java.lang.OutOfMemoryError - Failed to allocate a 1920012 byte allocation with 655288 free bytes and 639KB until OOM
java.lang.OutOfMemoryError: Failed to allocate a 1920012 byte allocation with 655288 free bytes and 639KB until OOM
        at com.codename1.v.w.b(Image.java:844)
        at com.codename1.v.w.w(Image.java:827)
        at com.codename1.impl.a.a(CodenameOneImplementation.java:2843)
        at com.codename1.v.w.m(Image.java:1073)
        at com.codename1.v.r.m(EncodedImage.java:680)
        at com.codename1.v.g.e.o(Style.java:1152)
        at com.codename1.impl.android.a$a.a(AndroidAsyncView.java:1225)
        at com.codename1.impl.android.d.a(AndroidImplementation.java:1866)
        at com.codename1.v.k$a.a(Component.java:5704)
        at com.codename1.v.k.s(Component.java:1937)
        at com.codename1.v.k.l(Component.java:1896)
        at com.codename1.v.k.b(Component.java:1549)
        at com.codename1.v.k.d(Component.java:1538)
        at com.codename1.v.k.a(Component.java:1513)
        at com.codename1.v.n.a(Container.java:1439)
        at com.codename1.v.k.b(Component.java:1564)
        at com.codename1.v.k.d(Component.java:1538)
        at com.codename1.v.k.a(Component.java:1513)
        at com.codename1.v.n.a(Container.java:1439)
        at com.codename1.v.k.b(Component.java:1564)
        at com.codename1.v.k.d(Component.java:1538)
        at com.codename1.v.k.a(Component.java:1513)
        at com.codename1.v.n.a(Container.java:1439)
        at com.codename1.v.k.b(Component.java:1558)
        at com.codename1.v.k.d(Component.java:1538)
        at com.codename1.v.k.a(Component.java:1513)
        at com.codename1.v.n.a(Container.java:1439)
        at com.codename1.v.k.b(Component.java:1564)
        at com.codename1.v.k.d(Component.java:1538)
        at com.codename1.v.k.a(Component.java:1513)
        at com.codename1.v.n.a(Container.java:1439)
        at com.codename1.v.k.b(Component.java:1564)
        at com.codename1.v.k.d(Component.java:1538)
        at com.codename1.v.k.a(Component.java:1513)
        at com.codename1.v.n.a(Container.java:1439)
        at com.codename1.v.k.b(Component.java:1564)
        at com.codename1.v.k.d(Component.java:1538)
        at com.codename1.v.k.a(Component.java:1513)
        at com.codename1.v.n.a(Container.java:1439)
        at com.codename1.v.k.b(Component.java:1564)
        at com.codename1.v.k.d(Component.java:1538)
        at com.codename1.v.k.a(Component.java:1513)
        at com.codename1.v.n.a(Container.java:1439)
        at com.codename1.v.k.b(Component.java:1564)
        at com.codename1.v.k.d(Component.java:1538)
        at com.codename1.v.k.a(Component.java:1513)
        at com.codename1.v.n.a(Container.java:1439)
        at com.codename1.v.k.b(Component.java:1564)
        at com.codename1.v.k.d(Component.java:1538)
        at com.codename1.v.k.a(Component.java:1513)
        at com.codename1.v.n.a(Container.java:1439)
        at com.codename1.v.k.b(Component.java:1564)
        at com.codename1.v.k.d(Component.java:1538)
        at com.codename1.v.k.a(Component.java:1513)
        at com.codename1.v.n.a(Container.java:1439)
        at com.codename1.v.u.a(Form.java:3256)
        at com.codename1.v.k.b(Component.java:1564)
        at com.codename1.v.u.b(Form.java:3266)
        at com.codename1.v.k.d(Component.java:1538)
        at com.codename1.v.k.a(Component.java:1513)
        at com.codename1.v.k.d(Component.java:1481)
        at com.codename1.v.k.c(Component.java:1766)
        at com.codename1.v.k.i(Component.java:1713)
        at com.codename1.impl.a.q(CodenameOneImplementation.java:585)
        at com.codename1.v.q.j(Display.java:1078)
        at com.codename1.v.q.i(Display.java:1000)
        at com.codename1.v.ag.run(RunnableWrapper.java:120)
        at com.codename1.impl.b$1.run(CodenameOneThread.java:60)
        at java.lang.Thread.run(Thread.java:761)





Shai Almog

unread,
May 27, 2017, 1:34:44 AM5/27/17
to CodenameOne Discussions
Can you add a finalizer to both forms and log the output when they get GC'd?

Carlos Verdier

unread,
May 27, 2017, 2:07:44 PM5/27/17
to CodenameOne Discussions
Hope this helps... This is from the simple test case, not the actual app.


05-27 19:54:03.853: I/art(30890): Background sticky concurrent mark sweep GC freed 15196(610KB) AllocSpace objects, 23(13MB) LOS objects, 4% free, 232MB/243MB, paused 5.093ms total 34.746ms
05-27 19:54:05.435: I/art(30890): Background sticky concurrent mark sweep GC freed 3687(110KB) AllocSpace objects, 1(11MB) LOS objects, 2% free, 232MB/239MB, paused 5.936ms total 81.379ms
05-27 19:54:10.274: I/art(4956): Explicit concurrent mark sweep GC freed 1638(42KB) AllocSpace objects, 0(0B) LOS objects, 44% free, 9MB/17MB, paused 210us total 16.998ms
05-27 19:54:10.305: I/art(4999): Explicit concurrent mark sweep GC freed 40(1656B) AllocSpace objects, 0(0B) LOS objects, 40% free, 12MB/20MB, paused 308us total 47.568ms
05-27 19:54:12.135: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:12.135: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:12.154: I/art(30890): Alloc sticky concurrent mark sweep GC freed 26109(977KB) AllocSpace objects, 31(17MB) LOS objects, 7% free, 233MB/252MB, paused 1.459ms total 18.417ms
05-27 19:54:12.159: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:12.159: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:12.197: I/art(30890): Alloc partial concurrent mark sweep GC freed 4094(228KB) AllocSpace objects, 48(17MB) LOS objects, 11% free, 227MB/256MB, paused 1.239ms total 38.427ms
05-27 19:54:13.581: I/art(30890): Waiting for a blocking GC Alloc
05-27 19:54:13.610: I/art(30890): WaitForGcToComplete blocked for 29.334ms for cause Alloc
05-27 19:54:13.610: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:21.280: I/art(4956): Explicit concurrent mark sweep GC freed 390(10KB) AllocSpace objects, 0(0B) LOS objects, 44% free, 9MB/17MB, paused 201us total 14.751ms
05-27 19:54:21.288: I/art(4999): Explicit concurrent mark sweep GC freed 448(117KB) AllocSpace objects, 1(16KB) LOS objects, 40% free, 12MB/20MB, paused 395us total 23.172ms
05-27 19:54:26.648: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:26.648: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:26.668: I/art(30890): Alloc sticky concurrent mark sweep GC freed 6144(203KB) AllocSpace objects, 5(10MB) LOS objects, 5% free, 241MB/256MB, paused 1.809ms total 19.444ms
05-27 19:54:26.710: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:26.710: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:26.764: I/art(30890): Alloc partial concurrent mark sweep GC freed 3387(192KB) AllocSpace objects, 48(30MB) LOS objects, 12% free, 222MB/254MB, paused 1.315ms total 53.095ms
05-27 19:54:29.471: I/art(30890): Waiting for a blocking GC Alloc
05-27 19:54:29.488: I/art(30890): WaitForGcToComplete blocked for 17.083ms for cause Alloc
05-27 19:54:29.488: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:31.580: I/art(30890): Waiting for a blocking GC Alloc
05-27 19:54:31.615: I/art(30890): WaitForGcToComplete blocked for 34.851ms for cause Alloc
05-27 19:54:31.615: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:31.657: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:31.657: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:31.667: I/art(30890): Alloc sticky concurrent mark sweep GC freed 6(264B) AllocSpace objects, 0(0B) LOS objects, 0% free, 255MB/256MB, paused 1.435ms total 9.871ms
05-27 19:54:31.668: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:31.706: I/art(30890): Alloc partial concurrent mark sweep GC freed 760(27KB) AllocSpace objects, 31(26MB) LOS objects, 10% free, 228MB/256MB, paused 1.313ms total 37.907ms
05-27 19:54:33.612: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:33.612: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:33.632: I/art(30890): Alloc sticky concurrent mark sweep GC freed 16591(636KB) AllocSpace objects, 26(17MB) LOS objects, 7% free, 237MB/256MB, paused 1.624ms total 20.680ms
05-27 19:54:34.750: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:34.750: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:34.801: I/art(30890): Alloc partial concurrent mark sweep GC freed 9911(430KB) AllocSpace objects, 21(13MB) LOS objects, 6% free, 239MB/256MB, paused 1.544ms total 50.507ms
05-27 19:54:34.816: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:34.816: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:34.823: I/art(30890): Alloc sticky concurrent mark sweep GC freed 91(2024B) AllocSpace objects, 0(0B) LOS objects, 1% free, 251MB/256MB, paused 1.390ms total 7.093ms
05-27 19:54:34.823: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:34.864: I/art(30890): Alloc partial concurrent mark sweep GC freed 919(31KB) AllocSpace objects, 32(15MB) LOS objects, 8% free, 235MB/256MB, paused 1.470ms total 41.049ms
05-27 19:54:34.907: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:34.907: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:34.914: I/art(30890): Alloc sticky concurrent mark sweep GC freed 6(264B) AllocSpace objects, 0(0B) LOS objects, 3% free, 246MB/256MB, paused 1.332ms total 6.380ms
05-27 19:54:34.914: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:34.954: I/art(30890): Alloc partial concurrent mark sweep GC freed 10(288B) AllocSpace objects, 1(11MB) LOS objects, 8% free, 235MB/256MB, paused 1.351ms total 39.904ms
05-27 19:54:36.849: I/art(30890): Waiting for a blocking GC Alloc
05-27 19:54:36.870: I/art(30890): Waiting for a blocking GC Alloc
05-27 19:54:36.880: I/art(30890): Waiting for a blocking GC Alloc
05-27 19:54:36.897: I/art(30890): WaitForGcToComplete blocked for 47.972ms for cause Alloc
05-27 19:54:36.897: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:36.897: I/art(30890): WaitForGcToComplete blocked for 27.376ms for cause Alloc
05-27 19:54:36.897: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:36.899: I/art(30890): WaitForGcToComplete blocked for 18.916ms for cause Alloc
05-27 19:54:36.899: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:37.012: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:37.012: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:37.063: I/art(30890): Alloc partial concurrent mark sweep GC freed 10751(413KB) AllocSpace objects, 22(11MB) LOS objects, 4% free, 243MB/256MB, paused 1.633ms total 50.506ms
05-27 19:54:39.726: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:39.726: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:39.741: I/art(30890): Alloc sticky concurrent mark sweep GC freed 4918(170KB) AllocSpace objects, 3(6MB) LOS objects, 3% free, 247MB/256MB, paused 1.461ms total 14.685ms
05-27 19:54:39.741: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:39.781: I/art(30890): Alloc partial concurrent mark sweep GC freed 880(42KB) AllocSpace objects, 21(14MB) LOS objects, 9% free, 232MB/256MB, paused 1.417ms total 39.700ms
05-27 19:54:39.828: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:39.828: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:39.837: I/art(30890): Alloc sticky concurrent mark sweep GC freed 96(2280B) AllocSpace objects, 1(11MB) LOS objects, 4% free, 244MB/256MB, paused 1.410ms total 8.837ms
05-27 19:54:39.946: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:39.946: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:40.002: I/art(30890): Alloc partial concurrent mark sweep GC freed 645(23KB) AllocSpace objects, 16(13MB) LOS objects, 5% free, 242MB/256MB, paused 1.763ms total 55.674ms
05-27 19:54:42.903: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:42.903: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:42.923: I/art(30890): Alloc sticky concurrent mark sweep GC freed 16617(646KB) AllocSpace objects, 24(3MB) LOS objects, 2% free, 249MB/256MB, paused 1.554ms total 20.037ms
05-27 19:54:42.960: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:42.960: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:43.011: I/art(30890): Alloc partial concurrent mark sweep GC freed 3789(222KB) AllocSpace objects, 16(16MB) LOS objects, 7% free, 237MB/256MB, paused 1.563ms total 50.078ms
05-27 19:54:44.178: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:44.178: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:44.198: I/art(30890): Alloc sticky concurrent mark sweep GC freed 5554(177KB) AllocSpace objects, 5(10MB) LOS objects, 5% free, 241MB/256MB, paused 2.536ms total 19.976ms
05-27 19:54:44.202: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:44.202: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:44.251: I/art(30890): Alloc partial concurrent mark sweep GC freed 1075(36KB) AllocSpace objects, 33(4MB) LOS objects, 2% free, 248MB/256MB, paused 1.495ms total 48.135ms
05-27 19:54:44.251: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:44.258: I/art(30890): Alloc sticky concurrent mark sweep GC freed 0(0B) AllocSpace objects, 0(0B) LOS objects, 2% free, 248MB/256MB, paused 1.617ms total 6.998ms
05-27 19:54:44.258: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:44.296: I/art(30890): Alloc concurrent mark sweep GC freed 485(17KB) AllocSpace objects, 0(0B) LOS objects, 2% free, 248MB/256MB, paused 1.508ms total 38.002ms
05-27 19:54:44.301: I/art(30890): Forcing collection of SoftReferences for 11MB allocation
05-27 19:54:44.301: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:44.342: I/art(30890): Alloc concurrent mark sweep GC freed 3(72B) AllocSpace objects, 0(0B) LOS objects, 2% free, 248MB/256MB, paused 1.444ms total 40.933ms
05-27 19:54:44.347: W/art(30890): Throwing OutOfMemoryError "Failed to allocate a 11993484 byte allocation with 7743096 free bytes and 7MB until OOM"
05-27 19:54:44.347: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:44.347: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:44.354: I/art(30890): Alloc sticky concurrent mark sweep GC freed 4(400B) AllocSpace objects, 0(0B) LOS objects, 2% free, 248MB/256MB, paused 1.568ms total 7.415ms
05-27 19:54:44.354: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:44.391: I/art(30890): Alloc partial concurrent mark sweep GC freed 6(144B) AllocSpace objects, 0(0B) LOS objects, 2% free, 248MB/256MB, paused 1.417ms total 36.062ms
05-27 19:54:44.391: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:44.428: I/art(30890): Alloc concurrent mark sweep GC freed 3(72B) AllocSpace objects, 0(0B) LOS objects, 2% free, 248MB/256MB, paused 1.472ms total 37.321ms
05-27 19:54:44.428: I/art(30890): Forcing collection of SoftReferences for 11MB allocation
05-27 19:54:44.428: I/art(30890): Starting a blocking GC Alloc
05-27 19:54:44.465: I/art(30890): Alloc concurrent mark sweep GC freed 3(72B) AllocSpace objects, 0(0B) LOS objects, 2% free, 248MB/256MB, paused 1.364ms total 36.855ms
05-27 19:54:44.556: I/art(30890): HomogeneousSpaceCompact marksweep + semispace GC freed 3(72B) AllocSpace objects, 0(0B) LOS objects, 2% free, 248MB/256MB, paused 90.141ms total 90.141ms
05-27 19:54:44.556: W/art(30890): Throwing OutOfMemoryError "Failed to allocate a 11993484 byte allocation with 7735512 free bytes and 7MB until OOM"
05-27 19:54:44.607: E/AndroidRuntime(30890): java.lang.OutOfMemoryError: Failed to allocate a 11993484 byte allocation with 7735512 free bytes and 7MB until OOM
05-27 19:54:44.607: E/AndroidRuntime(30890): at java.nio.IntBuffer.allocate(IntBuffer.java:128)
05-27 19:54:45.065: I/art(3309): Background partial concurrent mark sweep GC freed 143555(11MB) AllocSpace objects, 6(136KB) LOS objects, 33% free, 38MB/57MB, paused 3.462ms total 182.165ms
05-27 19:54:48.232: I/art(4956): Explicit concurrent mark sweep GC freed 1482(38KB) AllocSpace objects, 0(0B) LOS objects, 44% free, 9MB/17MB, paused 5.417ms total 81.546ms
05-27 19:54:48.237: I/art(4999): Explicit concurrent mark sweep GC freed 507(29KB) AllocSpace objects, 0(0B) LOS objects, 40% free, 12MB/20MB, paused 574us total 88.759ms
05-27 19:54:53.711: I/art(3309): Background partial concurrent mark sweep GC freed 38324(2MB) AllocSpace objects, 3(60KB) LOS objects, 33% free, 36MB/54MB, paused 2.543ms total 221.814ms
05-27 19:54:58.632: I/art(4269): Background partial concurrent mark sweep GC freed 89851(5MB) AllocSpace objects, 18(29MB) LOS objects, 38% free, 51MB/83MB, paused 1.257ms total 119.848ms
05-27 19:55:11.697: E/qcbassboost(2712): EffectCreate: Allocating SessionNo 0 for SessionId 593
05-27 19:55:11.734: E/qcvirt(2712): EffectCreate: Allocating SessionNo 0 for SessionId 593


More details on the error:

05-27 19:54:44.607: E/AndroidRuntime(30890): java.lang.OutOfMemoryError: Failed to allocate a 11993484 byte allocation with 7735512 free bytes and 7MB until OOM
05-27 19:54:44.607: E/AndroidRuntime(30890): at java.nio.HeapIntBuffer.<init>(HeapIntBuffer.java:49)
05-27 19:54:44.607: E/AndroidRuntime(30890): at java.nio.HeapIntBuffer.<init>(HeapIntBuffer.java:45)
05-27 19:54:44.607: E/AndroidRuntime(30890): at java.nio.IntBuffer.allocate(IntBuffer.java:128)
05-27 19:54:44.607: E/AndroidRuntime(30890): at com.google.maps.api.android.lib6.gmm6.vector.cc.i(:com.google.android.gms.DynamiteModulesB:1377)
05-27 19:54:44.607: E/AndroidRuntime(30890): at com.google.maps.api.android.lib6.gmm6.vector.cc.b(:com.google.android.gms.DynamiteModulesB:21138)
05-27 19:54:44.607: E/AndroidRuntime(30890): at com.google.maps.api.android.lib6.gmm6.vector.bj.f(:com.google.android.gms.DynamiteModulesB:1162)
05-27 19:54:44.607: E/AndroidRuntime(30890): at com.google.maps.api.android.lib6.gmm6.vector.bj.run(:com.google.android.gms.DynamiteModulesB:881)




Carlos Verdier

unread,
May 27, 2017, 2:51:42 PM5/27/17
to CodenameOne Discussions

Shai Almog

unread,
May 28, 2017, 12:00:51 AM5/28/17
to CodenameOne Discussions
None of the suggestions on stackoverflow seem relevant. Try running the test I asked for in the simulator, no need for device. I want to see if the map references are cleared and GC'd.

Carlos Verdier

unread,
May 28, 2017, 5:50:21 AM5/28/17
to CodenameOne Discussions
It his what you asked for? It looks like ParOldGen is always growing, but not sure if I'm reading it well.

[GC (Allocation Failure) [PSYoungGen: 33280K->1840K(38400K)] 33280K->1848K(125952K), 0.0053477 secs] [Times: user=0.01 sys=0.01, real=0.01 secs] 
[GC (Allocation Failure) [PSYoungGen: 27875K->2832K(38400K)] 27883K->36485K(125952K), 0.0418895 secs] [Times: user=0.10 sys=0.04, real=0.04 secs] 
[GC (Allocation Failure) [PSYoungGen: 26116K->2736K(38400K)] 59769K->70034K(125952K), 0.0286356 secs] [Times: user=0.06 sys=0.03, real=0.03 secs] 
[Full GC (Ergonomics) [PSYoungGen: 2736K->0K(38400K)] [ParOldGen: 67297K->25070K(113152K)] 70034K->25070K(151552K), [Metaspace: 11350K->11350K(1058816K)], 0.0331711 secs] [Times: user=0.09 sys=0.01, real=0.03 secs] 
[GC (Allocation Failure) [PSYoungGen: 22818K->96K(63488K)] 47888K->58803K(176640K), 0.0113823 secs] [Times: user=0.03 sys=0.00, real=0.01 secs] 
[GC (Allocation Failure) [PSYoungGen: 62560K->1376K(67584K)] 121267K->60091K(180736K), 0.0039437 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] 
[GC (System.gc()) [PSYoungGen: 44683K->2558K(118272K)] 103398K->66380K(231424K), 0.0060738 secs] [Times: user=0.01 sys=0.01, real=0.00 secs] 
[Full GC (System.gc()) [PSYoungGen: 2558K->0K(118272K)] [ParOldGen: 63821K->29136K(113152K)] 66380K->29136K(231424K), [Metaspace: 14783K->14783K(1062912K)], 0.0464835 secs] [Times: user=0.12 sys=0.00, real=0.05 secs] 
Rendering frame took too long 303 milliseconds
[GC (Metadata GC Threshold) [PSYoungGen: 28138K->3008K(118784K)] 57274K->32152K(231936K), 0.0082004 secs] [Times: user=0.01 sys=0.00, real=0.01 secs] 
[Full GC (Metadata GC Threshold) [PSYoungGen: 3008K->0K(118784K)] [ParOldGen: 29144K->31953K(140800K)] 32152K->31953K(259584K), [Metaspace: 24558K->24558K(1071104K)], 0.0847272 secs] [Times: user=0.24 sys=0.00, real=0.09 secs] 
Rendering frame took too long 419 milliseconds
[GC (System.gc()) [PSYoungGen: 35074K->4095K(173056K)] 67028K->36571K(313856K), 0.0085010 secs] [Times: user=0.02 sys=0.00, real=0.01 secs] 
[Full GC (System.gc()) [PSYoungGen: 4095K->0K(173056K)] [ParOldGen: 32475K->36170K(140800K)] 36571K->36170K(313856K), [Metaspace: 27771K->27771K(1075200K)], 0.1212326 secs] [Times: user=0.35 sys=0.01, real=0.12 secs] 
PI width: 521PI height 766
Creating peer image
Rendering frame took too long 174 milliseconds
[GC (System.gc()) [PSYoungGen: 32624K->3532K(172544K)] 68794K->39711K(313344K), 0.0081260 secs] [Times: user=0.02 sys=0.01, real=0.01 secs] 
[Full GC (System.gc()) [PSYoungGen: 3532K->0K(172544K)] [ParOldGen: 36178K->36713K(140800K)] 39711K->36713K(313344K), [Metaspace: 29031K->29029K(1075200K)], 0.0928665 secs] [Times: user=0.27 sys=0.01, real=0.09 secs] 
Rendering frame took too long 245 milliseconds
[GC (System.gc()) [PSYoungGen: 80801K->3069K(172032K)] 117515K->71304K(312832K), 0.0136225 secs] [Times: user=0.04 sys=0.00, real=0.01 secs] 
[Full GC (System.gc()) [PSYoungGen: 3069K->0K(172032K)] [ParOldGen: 68234K->49471K(140800K)] 71304K->49471K(312832K), [Metaspace: 30684K->30680K(1077248K)], 0.1149329 secs] [Times: user=0.30 sys=0.01, real=0.11 secs] 
PI width: 521PI height 766
Creating peer image
[GC (System.gc()) [PSYoungGen: 16636K->4836K(174080K)] 66108K->54316K(314880K), 0.0048236 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
[Full GC (System.gc()) [PSYoungGen: 4836K->0K(174080K)] [ParOldGen: 49479K->48816K(140800K)] 54316K->48816K(314880K), [Metaspace: 30793K->30793K(1077248K)], 0.0657403 secs] [Times: user=0.15 sys=0.01, real=0.07 secs] 
[GC (System.gc()) [PSYoungGen: 46266K->8887K(178176K)] 95083K->57712K(318976K), 0.0085618 secs] [Times: user=0.01 sys=0.01, real=0.01 secs] 
[Full GC (System.gc()) [PSYoungGen: 8887K->0K(178176K)] [ParOldGen: 48824K->50788K(140800K)] 57712K->50788K(318976K), [Metaspace: 31168K->31168K(1077248K)], 0.0815231 secs] [Times: user=0.19 sys=0.00, real=0.08 secs] 
PI width: 521PI height 766
Creating peer image
[GC (System.gc()) [PSYoungGen: 17401K->4868K(174080K)] 68189K->55665K(314880K), 0.0051710 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
[Full GC (System.gc()) [PSYoungGen: 4868K->0K(174080K)] [ParOldGen: 50796K->50534K(140800K)] 55665K->50534K(314880K), [Metaspace: 31247K->31247K(1077248K)], 0.0571227 secs] [Times: user=0.11 sys=0.00, real=0.06 secs] 
[GC (System.gc()) [PSYoungGen: 48552K->9048K(183808K)] 99087K->59590K(324608K), 0.0093259 secs] [Times: user=0.01 sys=0.01, real=0.01 secs] 
[Full GC (System.gc()) [PSYoungGen: 9048K->0K(183808K)] [ParOldGen: 50542K->52619K(140800K)] 59590K->52619K(324608K), [Metaspace: 31483K->31483K(1077248K)], 0.0626741 secs] [Times: user=0.14 sys=0.00, real=0.06 secs] 
PI width: 521PI height 766
Creating peer image
[GC (System.gc()) [PSYoungGen: 16612K->4836K(173568K)] 69232K->57464K(314368K), 0.0037079 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] 
[Full GC (System.gc()) [PSYoungGen: 4836K->0K(173568K)] [ParOldGen: 52627K->48959K(140800K)] 57464K->48959K(314368K), [Metaspace: 31513K->31513K(1077248K)], 0.0727738 secs] [Times: user=0.17 sys=0.01, real=0.07 secs] 
Rendering frame took too long 179 milliseconds
[GC (System.gc()) [PSYoungGen: 44778K->7945K(183808K)] 93738K->56913K(324608K), 0.0069313 secs] [Times: user=0.02 sys=0.00, real=0.01 secs] 
[Full GC (System.gc()) [PSYoungGen: 7945K->0K(183808K)] [ParOldGen: 48967K->52846K(140800K)] 56913K->52846K(324608K), [Metaspace: 31681K->31681K(1077248K)], 0.0645036 secs] [Times: user=0.16 sys=0.00, real=0.07 secs] 
PI width: 521PI height 766
Creating peer image
[GC (System.gc()) [PSYoungGen: 42631K->7412K(176640K)] 95477K->60267K(317440K), 0.0051787 secs] [Times: user=0.01 sys=0.00, real=0.01 secs] 
[Full GC (System.gc()) [PSYoungGen: 7412K->0K(176640K)] [ParOldGen: 52854K->54851K(140800K)] 60267K->54851K(317440K), [Metaspace: 31706K->31706K(1077248K)], 0.0759874 secs] [Times: user=0.17 sys=0.00, real=0.07 secs] 
[GC (System.gc()) [PSYoungGen: 43230K->7913K(183296K)] 98081K->62772K(324096K), 0.0053573 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] 
[Full GC (System.gc()) [PSYoungGen: 7913K->0K(183296K)] [ParOldGen: 54859K->57756K(140800K)] 62772K->57756K(324096K), [Metaspace: 31798K->31798K(1077248K)], 0.0573269 secs] [Times: user=0.12 sys=0.00, real=0.06 secs] 
PI width: 521PI height 766
Creating peer image
[GC (System.gc()) [PSYoungGen: 26516K->3453K(172544K)] 84272K->61218K(313344K), 0.0033234 secs] [Times: user=0.01 sys=0.00, real=0.01 secs] 
[Full GC (System.gc()) [PSYoungGen: 3453K->0K(172544K)] [ParOldGen: 57764K->57730K(140800K)] 61218K->57730K(313344K), [Metaspace: 31852K->31852K(1077248K)], 0.0587634 secs] [Times: user=0.10 sys=0.01, real=0.06 secs] 
Rendering frame took too long 299 milliseconds
[GC (System.gc()) [PSYoungGen: 48037K->7477K(182784K)] 105767K->65215K(323584K), 0.0055431 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] 
[Full GC (System.gc()) [PSYoungGen: 7477K->0K(182784K)] [ParOldGen: 57738K->54229K(140800K)] 65215K->54229K(323584K), [Metaspace: 32402K->32402K(1079296K)], 0.1150973 secs] [Times: user=0.28 sys=0.00, real=0.12 secs] 
PI width: 521PI height 766
Creating peer image
Rendering frame took too long 155 milliseconds
[GC (System.gc()) [PSYoungGen: 16636K->4836K(174080K)] 70865K->59073K(314880K), 0.0033639 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] 
[Full GC (System.gc()) [PSYoungGen: 4836K->0K(174080K)] [ParOldGen: 54237K->53505K(140800K)] 59073K->53505K(314880K), [Metaspace: 32414K->32414K(1079296K)], 0.0619993 secs] [Times: user=0.12 sys=0.01, real=0.06 secs] 
[GC (System.gc()) [PSYoungGen: 54074K->6817K(181248K)] 107579K->60330K(322048K), 0.0055425 secs] [Times: user=0.02 sys=0.01, real=0.01 secs] 
[Full GC (System.gc()) [PSYoungGen: 6817K->0K(181248K)] [ParOldGen: 53513K->55787K(140800K)] 60330K->55787K(322048K), [Metaspace: 32530K->32530K(1079296K)], 0.1034703 secs] [Times: user=0.26 sys=0.00, real=0.10 secs] 
PI width: 521PI height 766
Creating peer image
[GC (System.gc()) [PSYoungGen: 16383K->4836K(174080K)] 72171K->60624K(314880K), 0.0028296 secs] [Times: user=0.01 sys=0.00, real=0.01 secs] 
[Full GC (System.gc()) [PSYoungGen: 4836K->0K(174080K)] [ParOldGen: 55787K->55529K(140800K)] 60624K->55529K(314880K), [Metaspace: 32531K->32531K(1079296K)], 0.0617960 secs] [Times: user=0.11 sys=0.00, real=0.06 secs] 
[GC (System.gc()) [PSYoungGen: 49291K->9552K(180224K)] 104821K->65090K(321024K), 0.0057715 secs] [Times: user=0.01 sys=0.00, real=0.01 secs] 
[Full GC (System.gc()) [PSYoungGen: 9552K->0K(180224K)] [ParOldGen: 55537K->60291K(140800K)] 65090K->60291K(321024K), [Metaspace: 32613K->32613K(1079296K)], 0.0781340 secs] [Times: user=0.18 sys=0.00, real=0.07 secs] 
PI width: 521PI height 766
Creating peer image
[GC (System.gc()) [PSYoungGen: 16997K->4836K(181248K)] 77288K->65136K(322048K), 0.0033299 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] 
[Full GC (System.gc()) [PSYoungGen: 4836K->0K(181248K)] [ParOldGen: 60299K->59976K(140800K)] 65136K->59976K(322048K), [Metaspace: 32630K->32630K(1079296K)], 0.0550579 secs] [Times: user=0.10 sys=0.00, real=0.06 secs] 
[GC (System.gc()) [PSYoungGen: 48019K->9439K(181248K)] 107996K->69423K(322048K), 0.0066694 secs] [Times: user=0.02 sys=0.00, real=0.00 secs] 
[Full GC (System.gc()) [PSYoungGen: 9439K->0K(181248K)] [ParOldGen: 59984K->62571K(140800K)] 69423K->62571K(322048K), [Metaspace: 32713K->32713K(1079296K)], 0.0890149 secs] [Times: user=0.22 sys=0.00, real=0.09 secs] 
PI width: 521PI height 766
Creating peer image
[GC (System.gc()) [PSYoungGen: 16361K->3245K(181760K)] 78932K->65817K(322560K), 0.0028445 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] 
[Full GC (System.gc()) [PSYoungGen: 3245K->0K(181760K)] [ParOldGen: 62571K->58747K(140800K)] 65817K->58747K(322560K), [Metaspace: 32718K->32718K(1079296K)], 0.0586210 secs] [Times: user=0.10 sys=0.01, real=0.06 secs] 
[GC (System.gc()) [PSYoungGen: 53179K->9612K(181760K)] 111926K->68368K(322560K), 0.0059048 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] 
[Full GC (System.gc()) [PSYoungGen: 9612K->0K(181760K)] [ParOldGen: 58755K->60566K(140800K)] 68368K->60566K(322560K), [Metaspace: 32844K->32844K(1079296K)], 0.0798205 secs] [Times: user=0.17 sys=0.01, real=0.08 secs] 
PI width: 521PI height 766
Creating peer image
[GC (System.gc()) [PSYoungGen: 16348K->3245K(182272K)] 76914K->63811K(323072K), 0.0031352 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] 
[Full GC (System.gc()) [PSYoungGen: 3245K->0K(182272K)] [ParOldGen: 60566K->60342K(140800K)] 63811K->60342K(323072K), [Metaspace: 32849K->32849K(1079296K)], 0.0638806 secs] [Times: user=0.11 sys=0.00, real=0.06 secs] 
[GC (System.gc()) [PSYoungGen: 42092K->6477K(180736K)] 102435K->66827K(321536K), 0.0053651 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] 
[Full GC (System.gc()) [PSYoungGen: 6477K->0K(180736K)] [ParOldGen: 60350K->62837K(140800K)] 66827K->62837K(321536K), [Metaspace: 32957K->32957K(1079296K)], 0.0789909 secs] [Times: user=0.17 sys=0.00, real=0.08 secs] 
PI width: 521PI height 766
Creating peer image
[GC (System.gc()) [PSYoungGen: 16636K->3245K(181760K)] 79474K->66091K(322560K), 0.0026918 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
[Full GC (System.gc()) [PSYoungGen: 3245K->0K(181760K)] [ParOldGen: 62845K->62011K(140800K)] 66091K->62011K(322560K), [Metaspace: 32981K->32981K(1079296K)], 0.0655945 secs] [Times: user=0.13 sys=0.00, real=0.07 secs] 
[GC (System.gc()) [PSYoungGen: 48428K->9455K(181248K)] 110439K->71475K(322048K), 0.0053847 secs] [Times: user=0.01 sys=0.01, real=0.00 secs] 
[Full GC (System.gc()) [PSYoungGen: 9455K->0K(181248K)] [ParOldGen: 62019K->67491K(140800K)] 71475K->67491K(322048K), [Metaspace: 33069K->33069K(1079296K)], 0.0862171 secs] [Times: user=0.20 sys=0.00, real=0.09 secs] 
PI width: 521PI height 766
Creating peer image
[GC (System.gc()) [PSYoungGen: 17746K->4804K(181760K)] 85237K->72304K(322560K), 0.0028592 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] 
[Full GC (System.gc()) [PSYoungGen: 4804K->0K(181760K)] [ParOldGen: 67499K->63662K(140800K)] 72304K->63662K(322560K), [Metaspace: 33076K->33076K(1079296K)], 0.0623115 secs] [Times: user=0.12 sys=0.00, real=0.07 secs] 
[GC (System.gc()) [PSYoungGen: 47625K->9488K(181760K)] 111287K->73159K(322560K), 0.0049677 secs] [Times: user=0.01 sys=0.00, real=0.01 secs] 
[Full GC (System.gc()) [PSYoungGen: 9488K->0K(181760K)] [ParOldGen: 63670K->69141K(140800K)] 73159K->69141K(322560K), [Metaspace: 33147K->33147K(1079296K)], 0.0675156 secs] [Times: user=0.13 sys=0.00, real=0.06 secs] 
PI width: 521PI height 766
Creating peer image
[GC (System.gc()) [PSYoungGen: 16613K->3245K(182272K)] 85754K->72394K(323072K), 0.0027376 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] 
[Full GC (System.gc()) [PSYoungGen: 3245K->0K(182272K)] [ParOldGen: 69149K->65407K(140800K)] 72394K->65407K(323072K), [Metaspace: 33165K->33165K(1079296K)], 0.0674737 secs] [Times: user=0.12 sys=0.00, real=0.07 secs] 
[GC (System.gc()) [PSYoungGen: 42992K->6007K(181248K)] 108400K->71415K(322048K), 0.0047819 secs] [Times: user=0.01 sys=0.00, real=0.01 secs] 
[Full GC (System.gc()) [PSYoungGen: 6007K->0K(181248K)] [ParOldGen: 65407K->67398K(140800K)] 71415K->67398K(322048K), [Metaspace: 33188K->33188K(1079296K)], 0.0651704 secs] [Times: user=0.13 sys=0.00, real=0.06 secs] 
PI width: 521PI height 766
Creating peer image
[GC (System.gc()) [PSYoungGen: 16172K->4836K(174080K)] 83571K->72235K(314880K), 0.0027522 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] 
[Full GC (System.gc()) [PSYoungGen: 4836K->0K(174080K)] [ParOldGen: 67398K->66885K(140800K)] 72235K->66885K(314880K), [Metaspace: 33193K->33193K(1079296K)], 0.0747258 secs] [Times: user=0.15 sys=0.00, real=0.07 secs] 
[GC (System.gc()) [PSYoungGen: 49443K->9599K(180224K)] 116328K->76492K(321024K), 0.0056374 secs] [Times: user=0.02 sys=0.00, real=0.00 secs] 
[Full GC (System.gc()) [PSYoungGen: 9599K->0K(180224K)] [ParOldGen: 66893K->71951K(140800K)] 76492K->71951K(321024K), [Metaspace: 33259K->33259K(1079296K)], 0.0899575 secs] [Times: user=0.20 sys=0.01, real=0.09 secs] 
PI width: 521PI height 766
Creating peer image
[GC (System.gc()) [PSYoungGen: 17009K->4836K(181248K)] 88960K->76795K(322048K), 0.0029631 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] 
[Full GC (System.gc()) [PSYoungGen: 4836K->0K(181248K)] [ParOldGen: 71959K->71628K(140800K)] 76795K->71628K(322048K), [Metaspace: 33272K->33272K(1079296K)], 0.0703224 secs] [Times: user=0.13 sys=0.00, real=0.07 secs] 
[GC (System.gc()) [PSYoungGen: 50399K->9455K(181248K)] 122028K->81092K(322048K), 0.0064308 secs] [Times: user=0.02 sys=0.00, real=0.00 secs] 
[Full GC (System.gc()) [PSYoungGen: 9455K->0K(181248K)] [ParOldGen: 71636K->73881K(140800K)] 81092K->73881K(322048K), [Metaspace: 33357K->33357K(1079296K)], 0.0660993 secs] [Times: user=0.12 sys=0.00, real=0.07 secs] 
PI width: 521PI height 766
Creating peer image
[GC (System.gc()) [PSYoungGen: 16361K->4804K(181760K)] 90242K->78686K(322560K), 0.0032531 secs] [Times: user=0.01 sys=0.00, real=0.01 secs] 
[Full GC (System.gc()) [PSYoungGen: 4804K->0K(181760K)] [ParOldGen: 73881K->70384K(140800K)] 78686K->70384K(322560K), [Metaspace: 33359K->33359K(1079296K)], 0.0647572 secs] [Times: user=0.12 sys=0.00, real=0.06 secs] 
[GC (System.gc()) [PSYoungGen: 44374K->6202K(180736K)] 114758K->76594K(321536K), 0.0044856 secs] [Times: user=0.01 sys=0.00, real=0.01 secs] 
[Full GC (System.gc()) [PSYoungGen: 6202K->0K(180736K)] [ParOldGen: 70392K->72586K(140800K)] 76594K->72586K(321536K), [Metaspace: 33403K->33403K(1079296K)], 0.0691808 secs] [Times: user=0.14 sys=0.00, real=0.07 secs] 
PI width: 521PI height 766
Creating peer image
[GC (System.gc()) [PSYoungGen: 16383K->4836K(181248K)] 88970K->77423K(322048K), 0.0027160 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] 
[Full GC (System.gc()) [PSYoungGen: 4836K->0K(181248K)] [ParOldGen: 72586K->72114K(140800K)] 77423K->72114K(322048K), [Metaspace: 33415K->33415K(1079296K)], 0.0652120 secs] [Times: user=0.12 sys=0.01, real=0.07 secs] 
[GC (System.gc()) [PSYoungGen: 46040K->11568K(180224K)] 118154K->85249K(321024K), 0.0066632 secs] [Times: user=0.01 sys=0.00, real=0.01 secs] 
[Full GC (System.gc()) [PSYoungGen: 11568K->0K(180224K)] [ParOldGen: 73681K->78033K(140800K)] 85249K->78033K(321024K), [Metaspace: 33432K->33432K(1079296K)], 0.0705805 secs] [Times: user=0.13 sys=0.00, real=0.07 secs] 
PI width: 521PI height 766
Creating peer image
[GC (System.gc()) [PSYoungGen: 16338K->3245K(181248K)] 94372K->81279K(322048K), 0.0031236 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
[Full GC (System.gc()) [PSYoungGen: 3245K->0K(181248K)] [ParOldGen: 78033K->77628K(140800K)] 81279K->77628K(322048K), [Metaspace: 33433K->33433K(1079296K)], 0.0951400 secs] [Times: user=0.22 sys=0.01, real=0.10 secs] 





Shai Almog

unread,
May 29, 2017, 12:23:56 AM5/29/17
to CodenameOne Discussions
No. I want you to override the finalize method in the forms and print a log when they get GC'd

public void finalize() {
   Log.p("Gc of form 1");
}

Then reproduce the issue in the simulator to make sure the form gets gc'd and that you don't have a memory leak somewhere...

Carlos Verdier

unread,
May 29, 2017, 3:59:07 AM5/29/17
to CodenameOne Discussions
That's the first thing I tried, but it looks like finalize method is not implemented in cn1... 

Compile is forcing compliance to the supported API's/features for maximum device compatibility. This allows smaller
        code size and wider device support
Compiling 1 source file to /Users/carlos/NetBeansProjects/Proyecto/build/tmp
/Users/carlos/NetBeansProjects/Proyecto/src/com/miProyecto/Clase.java:53: error: method does not override or implement a method from a supertype
            @Override
1 error
/Users/carlos/NetBeansProjects/Proyecto/build.xml:57: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 0 seconds)


Steve Hannah

unread,
May 29, 2017, 12:13:35 PM5/29/17
to codenameone...@googlegroups.com
Remove the @Override annotation on your finalizer and it should work.

Steve

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discussions+unsub...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/3f6b193d-2e19-463e-be79-06eb17808055%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Steve Hannah
Software Developer
Codename One

Carlos Verdier

unread,
May 30, 2017, 7:33:07 AM5/30/17
to CodenameOne Discussions
Thanks, but the method is never called in this code:

    public void start() {
        if(current != null){
            current.show();
            return;
        }
        Form hi = new Form("Map Test", new BorderLayout(BorderLayout.CENTER_BEHAVIOR_CENTER_ABSOLUTE)) {            
            protected void finalize() throws Throwable {
                Log.p("Finaliza Form 1");
            }
        };
        Button btn = new Button("Show Map");
        hi.add(BorderLayout.CENTER, btn);        
        hi.show();
        Command back = new Command("Back") {
            @Override
            public void actionPerformed(ActionEvent evt) {
                hi.showBack();
            }            
        };        
        btn.addActionListener((evt) -> {
            System.gc();
            Form hi2 = new Form("Map show", new BorderLayout()) {
                protected void finalize() throws Throwable {
                    Log.p("Finaliza Form 2");
                }
            };
            hi2.getToolbar().addCommandToLeftBar(back);
            hi2.setBackCommand(back);
            MapContainer map = new MapContainer(MAP_KEY);
            hi2.add(BorderLayout.CENTER, map);
            hi2.show();        
        });    
    }


Anyway, this is the stack trace when it crashes on simulator:

java.lang.OutOfMemoryError: Java heap space
        at java.awt.image.DataBufferInt.<init>(DataBufferInt.java:75)
        at java.awt.image.Raster.createPackedRaster(Raster.java:467)
        at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1032)
        at java.awt.image.BufferedImage.<init>(BufferedImage.java:333)
        at sun.java2d.loops.GraphicsPrimitive.convertFrom(GraphicsPrimitive.java:557)
        at sun.java2d.loops.GraphicsPrimitive.convertFrom(GraphicsPrimitive.java:541)
        at sun.java2d.loops.MaskBlit$General.MaskBlit(MaskBlit.java:189)
        at sun.java2d.loops.Blit$GeneralMaskBlit.Blit(Blit.java:204)
        at sun.java2d.pipe.DrawImage.blitSurfaceData(DrawImage.java:959)
        at sun.java2d.pipe.DrawImage.renderImageCopy(DrawImage.java:577)
        at sun.java2d.pipe.DrawImage.tryCopyOrScale(DrawImage.java:310)
        at sun.java2d.pipe.DrawImage.transformImage(DrawImage.java:258)
        at sun.java2d.pipe.DrawImage.copyImage(DrawImage.java:76)
        at sun.java2d.pipe.DrawImage.copyImage(DrawImage.java:1014)
        at sun.java2d.pipe.ValidatePipe.copyImage(ValidatePipe.java:186)
        at sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.java:3318)
        at sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.java:3296)
        at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1586)
        at javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1502)
        at javax.swing.RepaintManager.paint(RepaintManager.java:1272)
        at javax.swing.JComponent.paint(JComponent.java:1042)
        at com.codename1.impl.javase.SEBrowserComponent$2$1.paint(SEBrowserComponent.java:136)
        at com.codename1.impl.javase.JavaSEPort.drawNativePeer(JavaSEPort.java:4406)
        at com.codename1.impl.javase.SEBrowserComponent.paint(SEBrowserComponent.java:598)
        at com.codename1.ui.Component.internalPaintImpl(Component.java:1564)
        at com.codename1.ui.Component.paintInternalImpl(Component.java:1538)
        at com.codename1.ui.Component.paintInternal(Component.java:1513)
        at com.codename1.ui.Container.paint(Container.java:1439)
        at com.codename1.ui.Component.internalPaintImpl(Component.java:1564)
        at com.codename1.ui.Component.paintInternalImpl(Component.java:1538)
        at com.codename1.ui.Component.paintInternal(Component.java:1513)
        at com.codename1.ui.Container.paint(Container.java:1439)


Shai Almog

unread,
May 31, 2017, 1:34:16 AM5/31/17
to CodenameOne Discussions
That's great it means the form isn't garbage collected which means there is a memory leak in the Java code not the native map code...
If you are using netbeans I would recommend opening the profiler tool in memory mode and trying to track down the stack of the memory leak.

Carlos Verdier

unread,
May 31, 2017, 6:39:22 AM5/31/17
to CodenameOne Discussions
I managed to fix the issue on my side, and now the forms a properly finalizing, but the memory leak is still there. This is the new code:

    public void start() {
        if(current != null){
            current.show();
            return;
        }
        mainForm();
    }
    private void mainForm() {
        Form hi = new Form("Map Test", new BorderLayout(BorderLayout.CENTER_BEHAVIOR_CENTER_ABSOLUTE)) {            
            protected void finalize() throws Throwable {                
                Log.p("Finaliza Form 1");
            }
        };
        Button btn = new Button("Show Map");
        hi.add(BorderLayout.CENTER, btn);        
        hi.show();
        btn.addActionListener((evt) -> {
            showMap();
        });    

    }
    private void showMap() {        
        Form hi2 = new Form("Map show", new BorderLayout()) {
            protected void finalize() throws Throwable {                      
                Log.p("Finaliza Form 2");
            }
        };
        hi2.setTransitionOutAnimator(CommonTransitions.createSlide(CommonTransitions.SLIDE_HORIZONTAL, true, 250));
        MapContainer map = new MapContainer(MAP_KEY);
        hi2.add(BorderLayout.CENTER, map);
        hi2.show();        
        Command back = new Command("Back") {
            @Override
            public void actionPerformed(ActionEvent evt) {
                hi2.removeComponent(map);
                mainForm();
            }            
        };                
        hi2.getToolbar().addCommandToLeftBar(back);
        hi2.setBackCommand(back);
        
    }


And this is the stack trace when the app crashes with OOM Error:

[Finalizer] 0:0:20,160 - Codename One revisions: 738cd10cf7f01a97f849e6502c26776cd2c5be74
2381

[Finalizer] 0:0:20,188 - Finaliza Form 2
[Finalizer] 0:0:20,189 - Finaliza Form 1
[Finalizer] 0:0:24,716 - Finaliza Form 2
[Finalizer] 0:0:24,716 - Finaliza Form 1
[Finalizer] 0:0:24,716 - Finaliza Form 2
[Finalizer] 0:0:24,716 - Finaliza Form 1
[Finalizer] 0:0:24,716 - Finaliza Form 2
[Finalizer] 0:0:24,716 - Finaliza Form 1
[Finalizer] 0:0:28,87 - Finaliza Form 1
[Finalizer] 0:0:31,224 - Finaliza Form 1
[Finalizer] 0:0:33,756 - Finaliza Form 1
[Finalizer] 0:0:37,303 - Finaliza Form 1
[Finalizer] 0:0:37,303 - Finaliza Form 2
[Finalizer] 0:0:40,583 - Finaliza Form 2
[Finalizer] 0:0:40,583 - Finaliza Form 1
[Finalizer] 0:0:43,440 - Finaliza Form 2
[Finalizer] 0:0:43,440 - Finaliza Form 1
[Finalizer] 0:0:45,926 - Finaliza Form 2
[Finalizer] 0:0:48,949 - Finaliza Form 1
[Finalizer] 0:0:48,949 - Finaliza Form 2
[Finalizer] 0:0:52,301 - Finaliza Form 1
[Finalizer] 0:0:52,301 - Finaliza Form 2
[Finalizer] 0:0:55,236 - Finaliza Form 2
[Finalizer] 0:0:55,236 - Finaliza Form 1
[Finalizer] 0:0:57,583 - Finaliza Form 2
[Finalizer] 0:0:57,583 - Finaliza Form 1
[Finalizer] 0:1:0,226 - Finaliza Form 2
[Finalizer] 0:1:0,226 - Finaliza Form 2
[Finalizer] 0:1:0,226 - Finaliza Form 1
[Finalizer] 0:1:0,226 - Finaliza Form 2
[Finalizer] 0:1:0,226 - Finaliza Form 2
[Finalizer] 0:1:0,226 - Finaliza Form 1
[Finalizer] 0:1:3,825 - Finaliza Form 1
[Finalizer] 0:1:6,23 - Finaliza Form 2
[Finalizer] 0:1:16,691 - Finaliza Form 1
[Finalizer] 0:1:18,510 - Finaliza Form 2
[Finalizer] 0:1:21,314 - Finaliza Form 1
[Finalizer] 0:1:21,314 - Finaliza Form 2
[Finalizer] 0:1:22,627 - Finaliza Form 1
[Finalizer] 0:1:24,987 - Finaliza Form 2
[Finalizer] 0:1:24,987 - Finaliza Form 1
[Finalizer] 0:1:27,414 - Finaliza Form 2
[Finalizer] 0:1:29,157 - Finaliza Form 1
[Finalizer] 0:1:31,214 - Finaliza Form 1
[Finalizer] 0:1:31,214 - Finaliza Form 2
[Finalizer] 0:1:32,740 - Finaliza Form 2
[Finalizer] 0:1:33,418 - Finaliza Form 1
[Finalizer] 0:1:35,76 - Finaliza Form 2
[Finalizer] 0:1:37,699 - Finaliza Form 1
[Finalizer] 0:1:37,700 - Finaliza Form 2
[Finalizer] 0:1:40,667 - Finaliza Form 1
[Finalizer] 0:1:40,667 - Finaliza Form 2
[Finalizer] 0:1:40,667 - Finaliza Form 1
[Finalizer] 0:1:43,252 - Finaliza Form 2
[Finalizer] 0:1:43,252 - Finaliza Form 2
[Finalizer] 0:1:43,252 - Finaliza Form 1
[Finalizer] 0:1:43,252 - Finaliza Form 2
[Finalizer] 0:1:43,252 - Finaliza Form 1
[Finalizer] 0:1:43,252 - Finaliza Form 2
[Finalizer] 0:1:43,252 - Finaliza Form 1
[Finalizer] 0:1:43,252 - Finaliza Form 2
[Finalizer] 0:1:43,252 - Finaliza Form 1
[Finalizer] 0:1:46,340 - Finaliza Form 1
[Finalizer] 0:1:48,893 - Finaliza Form 1
[Finalizer] 0:1:55,789 - Finaliza Form 1
[Finalizer] 0:1:59,299 - Finaliza Form 1
[Finalizer] 0:2:2,624 - Finaliza Form 2
[Finalizer] 0:2:2,624 - Finaliza Form 2
[Finalizer] 0:2:2,624 - Finaliza Form 2
[Finalizer] 0:2:2,624 - Finaliza Form 1
[Finalizer] 0:2:2,624 - Finaliza Form 2
[Finalizer] 0:2:2,624 - Finaliza Form 2
[Finalizer] 0:2:2,624 - Finaliza Form 2
[Finalizer] 0:2:2,624 - Finaliza Form 1
[Finalizer] 0:2:10,873 - Finaliza Form 1
[Finalizer] 0:2:26,855 - Finaliza Form 2
[Finalizer] 0:2:26,856 - Finaliza Form 2
[Finalizer] 0:2:26,856 - Finaliza Form 1
[Finalizer] 0:2:26,856 - Finaliza Form 2
[Finalizer] 0:2:26,856 - Finaliza Form 1
[Finalizer] 0:2:26,856 - Finaliza Form 2
[Finalizer] 0:2:26,856 - Finaliza Form 1
[Finalizer] 0:2:26,856 - Finaliza Form 2
[Finalizer] 0:2:26,856 - Finaliza Form 1
[Finalizer] 0:2:26,856 - Finaliza Form 2
[Finalizer] 0:2:26,856 - Finaliza Form 1
[Finalizer] 0:2:26,856 - Finaliza Form 2
[Finalizer] 0:2:26,856 - Finaliza Form 1
[Finalizer] 0:2:29,912 - Finaliza Form 1
[Finalizer] 0:2:36,457 - Finaliza Form 1
[Finalizer] 0:2:36,458 - Finaliza Form 2
[Finalizer] 0:2:36,458 - Finaliza Form 1
[Finalizer] 0:2:36,458 - Finaliza Form 2
[Finalizer] 0:2:36,458 - Finaliza Form 2
[Finalizer] 0:2:36,458 - Finaliza Form 1
[Finalizer] 0:2:50,789 - Finaliza Form 1
[Finalizer] 0:2:53,354 - Finaliza Form 2
[Finalizer] 0:2:53,355 - Finaliza Form 2
[Finalizer] 0:2:53,355 - Finaliza Form 1
[Finalizer] 0:2:53,355 - Finaliza Form 2
[Finalizer] 0:2:53,355 - Finaliza Form 1
[Finalizer] 0:2:53,355 - Finaliza Form 2
[Finalizer] 0:2:53,355 - Finaliza Form 1
[Finalizer] 0:2:53,355 - Finaliza Form 2
[Finalizer] 0:3:1,787 - Finaliza Form 1
[Finalizer] 0:3:4,92 - Finaliza Form 2
[Finalizer] 0:3:4,92 - Finaliza Form 2
[Finalizer] 0:3:4,92 - Finaliza Form 1
[Finalizer] 0:3:4,92 - Finaliza Form 2
[Finalizer] 0:3:4,92 - Finaliza Form 1
[Finalizer] 0:3:4,92 - Finaliza Form 2
[Finalizer] 0:3:4,92 - Finaliza Form 1
[Finalizer] 0:3:7,157 - Finaliza Form 1
[Finalizer] 0:3:9,990 - Finaliza Form 2
[Finalizer] 0:3:9,990 - Finaliza Form 1
[Finalizer] 0:3:9,991 - Finaliza Form 2
[Finalizer] 0:3:14,303 - Finaliza Form 1
[Finalizer] 0:3:16,239 - Finaliza Form 1
[Finalizer] 0:3:16,239 - Finaliza Form 2
[Finalizer] 0:3:19,755 - Finaliza Form 2
[Finalizer] 0:3:19,756 - Finaliza Form 1
[Finalizer] 0:3:19,757 - Finaliza Form 2
[Finalizer] 0:3:22,355 - Finaliza Form 2
[Finalizer] 0:3:22,355 - Finaliza Form 1
[Finalizer] 0:3:27,11 - Finaliza Form 1
[Finalizer] 0:3:27,24 - Finaliza Form 2
[Finalizer] 0:3:27,25 - Finaliza Form 1
[Finalizer] 0:3:29,647 - Finaliza Form 1
[Finalizer] 0:3:32,405 - Finaliza Form 1
[Finalizer] 0:3:32,405 - Finaliza Form 2
[Finalizer] 0:3:33,952 - Finaliza Form 2
[Finalizer] 0:3:35,787 - Finaliza Form 2
[Finalizer] 0:3:38,391 - Finaliza Form 1
[Finalizer] 0:3:38,391 - Finaliza Form 2
[Finalizer] 0:3:38,391 - Finaliza Form 1
[Finalizer] 0:3:41,122 - Finaliza Form 1
[Finalizer] 0:3:44,393 - Finaliza Form 2
[Finalizer] 0:3:47,230 - Finaliza Form 1
[Finalizer] 0:3:47,230 - Finaliza Form 2
[Finalizer] 0:3:47,230 - Finaliza Form 2
[Finalizer] 0:3:48,537 - Finaliza Form 1
[Finalizer] 0:3:50,379 - Finaliza Form 2
[Finalizer] 0:3:53,643 - Finaliza Form 2
[Finalizer] 0:3:53,660 - Finaliza Form 1
[Finalizer] 0:3:56,580 - Finaliza Form 2
[Finalizer] 0:3:56,581 - Finaliza Form 1
[Finalizer] 0:3:58,89 - Finaliza Form 1
[Finalizer] 0:4:0,176 - Finaliza Form 1
[Finalizer] 0:4:0,176 - Finaliza Form 2
[Finalizer] 0:4:2,471 - Finaliza Form 2
[Finalizer] 0:4:3,697 - Finaliza Form 1
[Finalizer] 0:4:6,6 - Finaliza Form 1
[Finalizer] 0:4:6,6 - Finaliza Form 2
[Finalizer] 0:4:8,615 - Finaliza Form 2
[Finalizer] 0:4:10,36 - Finaliza Form 1
[Finalizer] 0:4:12,113 - Finaliza Form 1
[Finalizer] 0:4:12,113 - Finaliza Form 2
[Finalizer] 0:4:14,461 - Finaliza Form 2
[Finalizer] 0:4:16,632 - Finaliza Form 1
[Finalizer] 0:4:20,579 - Finaliza Form 1
[Finalizer] 0:4:20,579 - Finaliza Form 2
[Finalizer] 0:4:24,833 - Finaliza Form 1
[Finalizer] 0:4:24,834 - Finaliza Form 2
[Finalizer] 0:4:27,765 - Finaliza Form 2
[Finalizer] 0:4:28,983 - Finaliza Form 1
[Finalizer] 0:4:32,703 - Finaliza Form 2
[Finalizer] 0:4:35,674 - Finaliza Form 2
[Finalizer] 0:4:35,674 - Finaliza Form 1
[Finalizer] 0:4:37,726 - Finaliza Form 1
[Finalizer] 0:4:39,4 - Finaliza Form 2
[Finalizer] 0:4:39,811 - Finaliza Form 1
[Finalizer] 0:4:41,615 - Finaliza Form 2
[Finalizer] 0:4:42,219 - Finaliza Form 1
[Finalizer] 0:4:44,895 - Finaliza Form 2
[Finalizer] 0:4:45,576 - Finaliza Form 1
[Finalizer] 0:4:47,475 - Finaliza Form 2
[Finalizer] 0:4:47,946 - Finaliza Form 1
[Finalizer] 0:4:50,113 - Finaliza Form 2
[Finalizer] 0:4:50,693 - Finaliza Form 1
[Finalizer] 0:4:52,860 - Finaliza Form 2
[Finalizer] 0:4:54,60 - Finaliza Form 1
[Finalizer] 0:4:55,921 - Finaliza Form 2
[Finalizer] 0:4:57,581 - Finaliza Form 1
[Finalizer] 0:4:58,461 - Finaliza Form 2
[EDT] 0:4:59,865 - An exception occurred during transition paint this might be valid in case of a resize in the middle of a transition
[EDT] 0:4:59,867 - Exception: java.lang.OutOfMemoryError - Java heap space
 at com.codename1.ui.Container.paint(Container.java:1439)
        at com.codename1.ui.Component.internalPaintImpl(Component.java:1564)
        at com.codename1.ui.Component.paintInternalImpl(Component.java:1538)
        at com.codename1.ui.Component.paintInternal(Component.java:1513)
        at com.codename1.ui.Container.paint(Container.java:1439)
[EDT] 0:5:0,438 - An exception occurred during transition paint this might be valid in case of a resize in the middle of a transition
[EDT] 0:5:0,439 - Exception: java.lang.OutOfMemoryError - Java heap space
[EDT] 0:5:0,438 - An exception occurred during transition paint this might be valid in case of a resize in the middle of a transition
[EDT] 0:5:0,439 - Exception: java.lang.OutOfMemoryError - Java heap space
[Finalizer] 0:5:0,730 - Finaliza Form 1
[Finalizer] 0:5:4,605 - Finaliza Form 2
[Finalizer] 0:5:5,34 - Finaliza Form 1
[Finalizer] 0:5:43,1 - Finaliza Form 2
[EDT] 0:5:43,245 - Exception: java.lang.OutOfMemoryError - Java heap space
java.lang.OutOfMemoryError: Java heap space
[EDT] 0:5:43,264 - Exception in AppName version 1.0
[EDT] 0:5:43,264 - OS and
[EDT] 0:5:43,264 - Error java.lang.OutOfMemoryError: Java heap space
[EDT] 0:5:43,264 - Current Form null
[EDT] 0:5:43,264 - Exception: java.lang.OutOfMemoryError - Java heap space
java.lang.OutOfMemoryError: Java heap space


Carlos Verdier

unread,
May 31, 2017, 6:43:56 AM5/31/17
to CodenameOne Discussions

[Finalizer] 0:0:20,160 - Codename One revisions: 738cd10cf7f01a97f849e6502c26776cd2c5be74
2381
Some lines are missing in the previous post. Here is again.

Shai Almog

unread,
Jun 1, 2017, 1:10:09 AM6/1/17
to CodenameOne Discussions
Did this fix the issue on the device?
Sreve found a memory leak in BrowserComponent which might be responsible for the issue

Carlos Verdier

unread,
Jun 1, 2017, 4:03:41 AM6/1/17
to CodenameOne Discussions

Did this fix the issue on the device?

 
No, the problem is still there on the device, even with the new code I posted. 

Shai Almog

unread,
Jun 2, 2017, 1:40:57 AM6/2/17
to CodenameOne Discussions
You mentioned markers earlier. Is it possible you still have markers to older map instances?
Are you reusing the same Map Container instance or are you throwing them away each time (you should probably throw them away).

Carlos Verdier

unread,
Jun 2, 2017, 3:54:33 AM6/2/17
to CodenameOne Discussions
I would be easier if we stick to the last test case I posted. You can see everything there: no markers and new instance of Map Container each time.

Notice that I remove the map from his parent in the back command. If I don't do that, the form in never GC'd. I thought that was the problem, but no, even doing that the problems persits.

Shai Almog

unread,
Jun 3, 2017, 12:51:47 AM6/3/17
to CodenameOne Discussions
If you discard the whole form and the map container does it happen?
If you reuse the form instance and the map container does the memory leak happen?
We released an update that should solve a memory leak with browser component on the simulator.

Carlos Verdier

unread,
Jun 4, 2017, 2:56:18 PM6/4/17
to CodenameOne Discussions


On Saturday, June 3, 2017 at 6:51:47 AM UTC+2, Shai Almog wrote:
If you discard the whole form and the map container does it happen?

Yes it does happen.
 
If you reuse the form instance and the map container does the memory leak happen?

No. In this case, the OOM is never thrown and the app is stable.
 
We released an update that should solve a memory leak with browser component on the simulator.

And seems to have worked. Now I can't reproduce the problem on simulator.

Shai Almog

unread,
Jun 4, 2017, 11:38:06 PM6/4/17
to CodenameOne Discussions
In recent demos we reuse form instances more which is probably why we didn't run into this. Please file an issue, it will probably go to 3.8 since 3.7 is closing down and this has a workaround but we'll try to address it early in the 3.8 cycle.

Carlos Verdier

unread,
Jun 5, 2017, 10:04:47 AM6/5/17
to CodenameOne Discussions
Ok, done. Thank you for your help.
Reply all
Reply to author
Forward
0 new messages