I have an iOS application where I
(1) select a model to view in a list view in a navigation controller, and then segue to a view controller with an ARView to display the model
(2) I can then go back to the list view controller, select a different model, which then segues back to the view controller with the ARView
The new view controller with the ARView is loaded each time and deallocated each time I go back to select another model to view (I print("") with init?(), viewDidLoad(), and deinit)
I have the showStatistics turned of for the ARView:
arView.debugOptions = .showStatistics
I am seeing the Mesh count (Scene Mesh Stats: Meshes: from the debug stats) climb each time I exit the view controller and then reload it with another model (or the same one).
After doing this round trip several times (and growing the meshes), the frames per seconds start to drop
It seems as if while the view controller holding the ARView is allocated new and deallocated each round trip, the Meshes from the pprevious models are sticking around in the Metal pipeline or something. (I've never worked with Metal directly, and I am relatively new to ARKit & RealityKit).
Is that what is happening? If so, is there a command to flush the old meshes when I first load my view controller?
Thanks.