Post

Replies

Boosts

Views

Activity

Reply to RealityKit / visionOS – Memory not released after dismissing ImmersiveSpace with USDZ models
Hello, I'm reopening this issue because I noticed that with the new VisionOS 26, the memory cleaning got messed up again. As I said in my previous answer, I'd managed to solve the issue in the VisionOS 2.6. Everything was working fine, but after upgrading to VisionOS 26, the issue came back. The exact same code that was working before stopped working. The memory is no longer being cleaned after removing entities from parent and clearing all references to them. Is it some kind of breaking change to the ARC system? @Vision Pro Engineer I'd really appreciate your help here! Thanks in advance
Topic: Spatial Computing SubTopic: General Tags:
Nov ’25
Reply to RealityKit / visionOS – Memory not released after dismissing ImmersiveSpace with USDZ models
Thanks to @Vision Pro Engineer answer, I could find the solution! I tried checking for others references to the entities added in the ImmersiveSpace. Indeed, I could find some references and auxiliary entities that were not being explicitly removed from parent on dismiss. Also, I made sure to remove the rootEntity from the parent as I was not doing it before (I thought that removing the entities themselves would be enough). It worked! Now the memory almost goes back to the state before the ImmersiveSpace was opened. However, I did had to: force the .removeFromParent() for each non-nullable entities (MOST RELEVANT) ; reset the arrays and dictionary referencing entities to [] or [:]; nulling every reference for Textures, EnvironmentResources and Colliders etc (LESS RELEVANT); I think that this should not be the expected behavior. I guess that most developers would assume that this clean up is supposed to be automatically made when the ImmersiveSpace is dismissed and/or when the RealityView is dismissed. But thanks a lot for the help!
Topic: Spatial Computing SubTopic: General Tags:
Sep ’25