Memory Leak using simple app with visionOS

Hello.

When displaying a simple app like this:

struct ContentView: View {
    var body: some View {
        EmptyView()
    }
}

And run the Leaks app from the developer tools in Xcode, I see a memory leak which I don't see when running the same application on iOS.

You can simply run the app and it will show a memory leak. And this is what I see in the Leaks application.

Any ideas on what is going on?

Thanks!

Answered by DTS Engineer in 802371022

Hello @klinee101,

Thank you for bringing attention to this!

The "leaked object" identified by the Leaks instrument is 16 bytes in size.

When dealing with memory leaks, there are couple of important things to consider:

  1. Is the leak very large?
  2. Does the process continue to leak objects, thus inevitably resulting in the termination of the app eventually?
  3. Is your code responsible for the leaked object(s)?
  4. Is the leaked object using expensive or sensitive system resources? (i.e. it is somehow keeping the camera/mic activated unnecessarily)

If the answer to all of those questions is no, then it is okay to simply ignore the leak, since it isn't really causing an issue in the app.

You are also welcome to file a bug report for the leak using Feedback Assistant.

Best regards,

Greg

Updated the original post: If you replace the MetalView() simply with EmptyView() it still shows a memory leak.

Accepted Answer

Hello @klinee101,

Thank you for bringing attention to this!

The "leaked object" identified by the Leaks instrument is 16 bytes in size.

When dealing with memory leaks, there are couple of important things to consider:

  1. Is the leak very large?
  2. Does the process continue to leak objects, thus inevitably resulting in the termination of the app eventually?
  3. Is your code responsible for the leaked object(s)?
  4. Is the leaked object using expensive or sensitive system resources? (i.e. it is somehow keeping the camera/mic activated unnecessarily)

If the answer to all of those questions is no, then it is okay to simply ignore the leak, since it isn't really causing an issue in the app.

You are also welcome to file a bug report for the leak using Feedback Assistant.

Best regards,

Greg

Memory Leak using simple app with visionOS
 
 
Q