google-ar / arcore-android-sdk

ARCore SDK for Android Studio
https://developers.google.com/ar
Other
4.98k stars 1.22k forks source link

Native memory grows by between 10 and 30MB/min when ArSession_update is executed in a background thread #1338

Open ptc-aeveritt opened 2 years ago

ptc-aeveritt commented 2 years ago

SPECIFIC ISSUE ENCOUNTERED

VERSIONS USED

STEPS TO REPRODUCE THE ISSUE

  1. Take the computervision_c sample and modify it.
  2. In ComputerVisionApplication::OnResume create a thread, in the thread body create a GLES2 context, create an ArSession then start a loop calling ArSession_update. I can provide our modified version of the sample.
  3. Profile the modified App on device and observe memory growth

WORKAROUNDS (IF ANY)

None so far

ADDITIONAL COMMENTS

devbridie commented 2 years ago

It would be great if you could add the repro so I can have a try; thanks.

ptc-aeveritt commented 2 years ago

Hi - I have pushed changes to a fork of this repo, hopefully this will work for you. Please take a look at this branch - https://github.com/ptc-aeveritt/arcore-android-sdk/tree/bug/1338_memory_growth

While testing these changes I have noticed that with ARCore 1.22 (no memory growth) I get a new frame every update once the session has settled down at the start. Compare this with ARCore 1.29 (memory growth) where I see a significant proportion of updates where the frame timestamp does not move on.