mapbox / mapbox/mapbox-arkit-ios

Memory leak

Open
#30 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
227
Forks
45
PR merge metrics
No merged PRs in 30d

Description

I am encountering a persistent memory allocation issue with this otherwise awesome library.

Specifically, when a UIPopoverPresentationController (showing a modal VC with extended data on a given node, in response to user interaction) is presented and dismissed repeatedly, the app crashes with a [Render] CoreAnimation: failed to allocate IOSurface error.

This appears to be an issue related to the handling of nodes on calling the session.pause() method from the AR VC's viewDidDisappear code. I suspect this problem is related to the the issue discussed here:
https://stackoverflow.com/questions/28738551/how-can-i-remove-all-nodes-from-a-scenekit-scene

It looks like the annotationManager class here is not fully deallocating resources when the session is paused (nor on on calling removeAllAnnotations). Unfortunately I haven't been able to resolve this based on the SO answer.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing annotationManager's handling of nodes during session.pause() from the AR view controller's viewDidDisappear and during removeAllAnnotations. Reproduce repeated UIPopoverPresentationController presentation and dismissal, then verify that resources are released and the repeated flow no longer reaches the CoreAnimation IOSurface allocation failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, swift
Domain
computer-graphics, mobile-dev, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.