RoboViewController instances never GC'ed ?

33 views
Skip to first unread message

Guillermo Rodriguez Garcia

unread,
Mar 19, 2019, 4:35:24 AM3/19/19
to PlayN
Hi all,

For some reason I am seeing that the RoboViewController instances that I create are never GC'ed.

In a simple test app I do the following:

UIViewController roboVC = new RoboViewController(UIScreen.getMainScreen().getBounds(), new RoboPlatform.Config()) {
@Override
protected void doDispose() {
super.doDispose();
System.out.println("RoboViewController.doDispose");
}
};
System.out.println("RoboViewController: retain count = " + roboVC.retainCount());
roboVC = null;

UIViewController vc2 = new UIViewController() {
@Override
protected void doDispose() {
super.doDispose();
System.out.println("UIViewController.doDispose");
}
};
System.out.println("UIViewController: retain count = " + vc2.retainCount());
vc2 = null;

After some time, the GC will kick in, and I see UIViewController.doDispose printed to the console.

However I never see the RoboViewController.doDispose trace.

Any ideas what might be going on here?

Guillermo

Guillermo Rodriguez Garcia

unread,
Mar 19, 2019, 10:54:58 AM3/19/19
to PlayN
OK I think that I now have a better idea of what's happening.

The problem I am facing is related to the internals of RoboVM and is in fact a variation of the issues described here: https://github.com/robovm/robovm/issues/749

The story is a bit involved so I thought that it would be better to document it in an issue (https://github.com/playn/playn/issues/73).

There's also a PR that fixes it: https://github.com/playn/playn/pull/74

BR,

Guillermo

Michael Bayne

unread,
Mar 19, 2019, 1:03:12 PM3/19/19
to pl...@googlegroups.com
Awesome, thanks for tracking this down!

--

---
You received this message because you are subscribed to the Google Groups "PlayN" group.
To unsubscribe from this group and stop receiving emails from it, send an email to playn+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--

Guillermo Rodriguez Garcia

unread,
Mar 20, 2019, 4:54:26 AM3/20/19
to PlayN
Hi Michael,

One further question about RoboVC. Why does it need to add a "strong ref" to the platform instance ?

Guillermo

Michael Bayne

unread,
Mar 25, 2019, 12:33:13 PM3/25/19
to pl...@googlegroups.com
Not sure. That got added via a patch that I didn't write, way back in the day. It looks like perhaps back when that code was added, RoboViewController didn't maintain a reference to the RoboPlatform object itself, so perhaps it was necessary then but not necessary now that RoboViewController has an actual reference to RoboPlatform?

Is it causing problems or are you just curious?

Guillermo Rodriguez Garcia

unread,
Mar 26, 2019, 4:31:51 AM3/26/19
to pl...@googlegroups.com
Hi Michael,

El lun., 25 mar. 2019 a las 17:33, Michael Bayne (<m...@samskivert.com>) escribió:
Not sure. That got added via a patch that I didn't write, way back in the day. It looks like perhaps back when that code was added, RoboViewController didn't maintain a reference to the RoboPlatform object itself, so perhaps it was necessary then but not necessary now that RoboViewController has an actual reference to RoboPlatform?

Is it causing problems or are you just curious?

No problems (that I am aware of). I am trying to track a memory leak where platform instances are not GC'ed and just came across this, and was curious about it.

Guillermo


--
Guillermo Rodriguez Garcia
guille.r...@gmail.com

Guillermo Rodriguez Garcia

unread,
Mar 27, 2019, 4:37:07 AM3/27/19
to PlayN
I think I finally found the leak: https://github.com/playn/playn/pull/76

Guillermo

Guillermo
 

To unsubscribe from this group and stop receiving emails from it, send an email to playn+unsubscribe@googlegroups.com.

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


--

--

---
You received this message because you are subscribed to the Google Groups "PlayN" group.
To unsubscribe from this group and stop receiving emails from it, send an email to playn+unsubscribe@googlegroups.com.

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

Michael Bayne

unread,
Mar 29, 2019, 10:18:49 AM3/29/19
to pl...@googlegroups.com
Awesome, thanks for digging into this!

Guillermo Rodriguez Garcia
guille.r...@gmail.com

--

---
You received this message because you are subscribed to the Google Groups "PlayN" group.
To unsubscribe from this group and stop receiving emails from it, send an email to playn+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--

Guillermo Rodriguez Garcia

unread,
Apr 4, 2019, 11:14:36 AM4/4/19
to pl...@googlegroups.com
Hi Michael,

You're welcome.
I have submitted another PR with (I think) the last remaining leak :-)

Guillermo
Reply all
Reply to author
Forward
0 new messages