I'm using XCode 7.0 with iOS 9.0 SDK & ARC, all profiling/testing done on an iPhone 5S with iOS 9. EDIT: for all screenshots, it was a single run: I ran a debug build straight from xcode, and then manually attached Instruments to it. So the screenshots are all from the exact same single test run. This memory growth (per xcode view) is 100% reproducible.
My app downloads ZIP files, unpacks them, and adds them to the camera roll. I've made sure to profile and catch memory leaks (ie. missing CGContextRelease) as well as using @autoreleasepool
etc
During unzipping, in xcode I see the memory usage shooting up fast, never-ending until the unzipping finishes, and I cannot explain this because there are no objects in Instruments that I can see being held onto. The memory is never released (per xcode's memory view). At the end of my test run I see 236MB used, with no memory warnings during unzipping. If I use Instruments' allocation tool, I see 50.2MB of heap and anonymous VM used. That's a huge difference!
The first thing I did was assume that [UIImage imageNamed:
was to blame (caching etc) because I have quite a few animated UIImageViews, so I spent time removing all imageNamed from my code, and using imageWithContentsOfFile
instead. That didn't help at all. I add the unzipped images to the camera roll with iOS 8 Photo framework like this: [PHAssetChangeRequest creationRequestForAssetFromImageAtFileURL:[NSURL fileURLWithPath:filePath]]
I've spent considerable time pouring through Instruments and web articles but to no avail. Can anyone answer these questions?
Thank you very much in advance for your help. Of course i'll post any source-code that would help, i'm just not sure where to begin...
XCODE MEMORY USAGE 236 MB
INSTRUMENTS
Swift is a programming language that is used for building iOS and Mac applications, while Xcode is not a programming language – it is a comprehensive IDE. Xcode is the canvas to write and program the code, while Swift is the actual code that your team is writing.
According to the StackShare community, Xcode has a broader approval, being mentioned in 1052 company stacks & 604 developers stacks; compared to Swift, which is listed in 994 company stacks and 541 developer stacks.
If you want an IOS app you must use Xcode. You can't make an app for android using Xcode or using Android Studio you can't write an app for IOS. But you can make an universal app using Visual Studio "Cordoba". Visual Studio best documented one and more community support you can find for.
Google's Android Studio is one of the best cross-platform IDEs that can serve as a free alternative to Xcode. The tool works seamlessly on the Windows, Linux and macOS operating systems. Several programming languages, such as Java, C++, Go, etc., are supported by this platform.
The most common cause of this is your configuration. By default when you run in Xcode, you build in Debug mode. When you profile in Instruments, by default, it builds Release. You can modify your Run and Profile configurations in your scheme to change this.
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