Log in or register to post comments

Heavy GC allocation

August 28, 2018 - 8:49am #1

I'm working on a mobile game using Vuforia. We are experiencing poor performance although having very few assets.

After running the profiler, I can see that VuforiaBehaviour.Update is generating 1.2 MB of alloc *per frame* + 7ms. GC.Alloc has 113 calls.

This is unacceptable. Does anyone know how to fix this?

Unity 2018.1.6f1, Vuforia 7.2.24

AttachmentSize
Image icon GC.Alloc160.98 KB

Heavy GC allocation

September 6, 2018 - 3:09pm #10

Hello again,

It is unlikely we will address the higher allocation numbers in the editor as it is purely meant as a prototyping and testing tool and not representative of a final product. I'm glad to see that you are getting the better numbers when running it on device.

Thanks,

Vuforia Engine Support

Heavy GC allocation

September 5, 2018 - 5:23am #9

You are right, the GC alloc is way lower on the mobile, from 1.2 MB to 2.0 KB. IMO, any kind of steady allocation per frame means that something isn't properly done and should be fixed... would you mind looking at it?



It would be a great improvement to fix that allocation issue even in the editor to get accurate and mobile-representative profiling data.

The profiler screenshot is actually analyzing a Google Pixel 2.

Thanks for your quick response and support! :)

AttachmentSize
Image icon vuforia_android_profiler.png82.13 KB

Heavy GC allocation

September 4, 2018 - 2:52pm #8

Hello again,

I discussed this with someone from the team and have some additional information. The method used to process the webcam image for Unity playmode is different from the process used on device. The method used in playmode is more expensive overall as playmode performance is not a concern for an end product. This means that the performance you are seeing should be different when tested on a device.

Would you be able to run your test again on a device you are targeting with your app and see what values you get there compared to in Unity playmode?

Thanks,

Vuforia Engine Support

Heavy GC allocation

September 3, 2018 - 7:11am #7

I wait for this answer to

 

thanks

Heavy GC allocation

August 31, 2018 - 9:17am #6

I'm currently investigating and discussing with the team to fully understand the expectations here. I'll update as soon as I have more information.

Thanks,

Vuforia Engine Support

Heavy GC allocation

August 31, 2018 - 5:57am #5

@Strasza any update?

Heavy GC allocation

August 30, 2018 - 10:44am #4

I tried again using a fresh new project. I added the strict minimum to work with vuforia. There you go, 22ms per frame in my pc editor.

Please help, this is a critical issue for the memory management, battery and fps in general. Thank you.

AttachmentSize
Image icon gc2.png717.78 KB

Heavy GC allocation

August 29, 2018 - 6:50am #3

VuforiaConfiguration

  • Delayed init ON
  • Cam device mode: optimize speed
  • Max tracked obj: 1
  • Device type: handheld
  • Track device pose: ON
  • Tracking mode: positional
  • Fusion mode: optimize for image target

VuforiaBehaviour

  • World center: Specific_target

I have a specific scene containing the AR setup and target. I start the app then load this additive scene and launch my vuforia init process like this:

VuforiaBehaviour.Instance.enabled = false;

VuforiaRuntimeUtilities.SetAllowedFusionProviders(FusionProviderType.OPTIMIZE_IMAGE_TARGETS_AND_VUMARKS);

VuforiaRuntime.Instance.InitVuforia();

m_ARCamera.depth = -100;

m_ARCamera.enabled = true;

m_ARCamera.tag = TAG_AR_CAMERA;

VuforiaBehaviour.Instance.enabled = true;

Then, I start an update loop that wait for the init state like this:

if (VuforiaRuntime.Instance.InitializationState == VuforiaRuntime.InitState.INITIALIZED)

{

    // Vuforia ready, process next game states..

}

That's pretty much it. At this point, the game has been launch for less than 1 second and I can see 1.2 MB of GC per frame (exactly like the screenshot attached in my previous message). Unity is in Android mode, webcam connected.

Heavy GC allocation

August 28, 2018 - 5:19pm #2

Hello gsylvain,

At what point in the app life cycle are you seeing this? Does this happen right away, or after running the app for a while? Which features are you using and how many targets are you detecting and/or tracking when you see this. Are you using Extended Tracking?

Thanks,

Vuforia Engine Support

Log in or register to post comments