I am trying to understand , what is meaning of transient and persistent Column in Allocation Template . From the tutorial http://www.raywenderlich.com/97886/instruments-tutorial-with-swift-getting-started I have found "The Persistent column keeps a count of the number of objects of each type that currently exist in memory. The Transient column shows the number of objects that have existed but have since been deallocated. Persistent objects are using up memory, transient objects have had their memory released. "
According to the explanation above , From the selected row in Statistics table from the picture , it can be said , 2 objects of NSFileManager currently exist in memory and 19 no. of objects are created and already have been released.
But what it means for optimization or performance issues for iOS App ? Something like , here the total no of transient object in 19 which is considerably a large number , it should be small if possible for increasing app's effective memory usability or Something else ?
Instrumenting AllocationsPress Command-I in Xcode, select Allocations from the list and press Choose. After a moment, you'll see the Allocations instrument. It should look familiar because it looks a lot like Time Profiler. Click the record button in the top-left corner to run the app.
Instruments is a powerful performance analysis and testing tool that's part of Xcode toolset. Instruments can help you profile your apps on all platforms - iOS, macOS, watchOS, tvOS - in order to better understand and optimize their behavior and performance.
Launch Instruments from the Dock: Control-click the Xcode icon in the Dock, and then choose Options > Open Developer Tool > Instruments from the shortcut menu to launch Instruments.
Persistent objects are using up memory, transient objects have had their memory released.
The first says # Persistent. This is the number of persistent objects that are being strongly referenced in your project at this moment in time. The second says # Transient. This is the number of deallocated objects that used to be strongly retained but now no longer exist. This is handy because it lets you know if an object is being cleaned up properly or if an object in no longer retained in a particular moment in time. The third says # Total. This is the total count of persistent and transient objects added together.
Optimization for performance in short means keeping your app alive and responsive. The key metric for optimization is not transient or persistent count for one object.
Based on the information your NSFileManager
is using 16 Bytes for each object.
So it's 32 currently persistent (2 * 16) and 336 (21 * 16) Total.
A high persistent memory indicates that your current footprint is very high for the given object. A high total memory indicates that your footprint in past might have been high (if subset of those allocation were simultaneous)
While optimizing you should focus on mainly two aspects: 1. How much is the minimum memory foot print when your app loads. 2. How much is the maximum memory foot print. (You need to come up with use cases to figure out this one).
As your memory footprint increases your app slows down in performance because of multiple page swaps done by OS to free up memory. You can track this by VM tracker instrument. Optimization means keeping your average memory footprint lower that point.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With