Question
I would like to add error handling logic to my SwiftUI app that retrieves a memory graph in production (or at least, the number of instances of each class currently in memory). Is this possible? If not, are there any other approaches you can share to help profile memory programmatically?
Details
I have an iOS app in production. Users typically keep the app open for many/long sessions and occasionally I get a report that something isn’t working as expected. It can be difficult to reproduce their error cases, because several people may be using a single app over many hours/days without a restart.
In development, I like to use the debug memory graph to verify that new code does not leak object references. It would be valuable to generate and upload a memory graph like this when a production user experiences an error.
Also, the app is integrated with the New Relic iOS agent, but as far as I can tell, it only reports how much memory is in use.