Memory usage is much higher on RoboVM than equivalent Android app

237 views
Skip to first unread message

Matt Blair

unread,
Jun 14, 2015, 12:25:05 AM6/14/15
to rob...@googlegroups.com
I'm developing a game using libGDX and RoboVM for Android and iOS. We hadn't originally planned to deploy to iOS but I've been so impressed with RoboVM that we now expect to launch iOS simultaneously with Android!

The one major issue we have with our RoboVM build right now is excessive memory usage.

A typical gameplay scene on Android will use about 85MB (Java heap and native heap combined). The same code (minus the launcher, of course) will hog about 180MB on iOS (measured via Activity Monitor in Instruments).

I'm sure we're not making perfectly optimal use of our memory, but this is a little crazy. The real difficulty is that I don't know how to get a detailed profile of our memory usage on iOS. I've tried manually calling the GC multiple times but I can't make any more educated optimizations until I know where the memory is coming from.

So I have two questions:

1. Is there a way to determine how memory is being used within my application?

2. Are there any tricks I can use to reduce my memory usage on iOS (or conversely, anything bad for memory that I shouldn't be doing)?

Thanks!

Mario Zechner

unread,
Jun 15, 2015, 5:06:06 AM6/15/15
to rob...@googlegroups.com, blai...@gmail.com
What's the split between native and Java heap? For the latter, you can use the Gdx.app functions that give you some memory stats. The former is a little harder to calculate via the GDX functions as textures and other things stored in VRAM are also counted against native. Android may actually not tell you the full story as these resources may not be reported at all.

We are planning on a memory profiler for RoboVM, but i can't give an ETA on that yet.

Matt Blair

unread,
Jul 8, 2015, 1:05:30 AM7/8/15
to rob...@googlegroups.com
Just to follow up on this for posterity, the reason that memory usage seemed so wildly different between Android and iOS for my game was, indeed, texture memory. GL memory usage is included in the "memory usage" reported on iOS by the Activity Monitor instrument, but on Android I've found that it's excluded from both Java heap and native heap memory usage. The only way I've found to track GL memory usage on Android is:

adb shell dumpsys meminfo [packageName] -d

In which graphics memory will often be reported in a category like "other dev" or "graphics" (depending on the manufacturer).
Reply all
Reply to author
Forward
0 new messages