Skip to content Skip to sidebar Skip to footer

Monodroid: Performing A Full Gc

I try to create my small particle system. I have ParticleManager with list of Particles and draw my particles on canvas. I create any new objects like Paint and etc once just in in

Solution 1:

The primary problem is that you have too many Java.Lang.Object instances alive at once, as each Java.Lang.Object instance contributes to the JNI global reference count, which also contributes to GC overhead. Want to reduce GC overhead? Reduce the number of GREFs you use.

You can track the GREF count by enabling gref logging

adb shell setprop debug.mono.log gref

I assume that Particle is a Java.Lang.Object subclass, meaning you have at leastparticles.Count GREFs alive at once.

The solution is to not make Particle a Java.Lang.Object subclass, and alter your architecture in any way to ensure that Particle isn't one.

If Particle isn't a Java.Lang.Object instance, then we lack sufficient information to reproduce the problem and suggest a solution. GREF logging output would be a handy start (how many GREFs do you have at once?), as it will also help you determine which types are being created so you can consider reducing their lifetime.

This guide on reading gref log output may also be handy.

Post a Comment for "Monodroid: Performing A Full Gc"