Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread Display Modes
Old Mar 11, 2012, 09:28 PM   #1
macrumors member
Join Date: Dec 2008
Location: Japan
Why is my app taking up so much memory (>12MB)?

My app consists of an UIImageView that can hold an image from the photo library and some overlay controls for applying B&W, sepia, and enhance image effects using the NYXImagesKit library. When I select an image from the photo library I display it on the UIImageView and save the photo as a PNG image file to the app's Documents directory for persistence. Whenever I apply an effect to the image, I write that image with the effect applied as an additional PNG file (alongside the original) to the Documents directory. My problem is that when I click the controls to apply the image filters, the app uses lots of memory (above 12MB) and eventually crashes.

The app is built using ARC so theoretically memory leaks should be fairly well taken care of, so I'm guessing it's my actual way of adding effects that's inefficient and eating up resources. If any of you are seasoned programmers, could you take a look at my code and point out what's causing the huge memory usage? If you could that would be absolutely wonderful.

Instructions for the app: double-tap to reveal the overlay image effects controls and tap once to hide them.
Attached Files
File Type: zip Test (231.1 KB, 10 views)

Last edited by stephenbenedict; Mar 17, 2012 at 09:35 PM.
stephenbenedict is offline   -2 Reply With Quote
Old Mar 17, 2012, 09:15 PM   #2
Thread Starter
macrumors member
Join Date: Dec 2008
Location: Japan

In my original code, I applied image effects using the library NYXImagesKit and then saved those modified images as PNG files into my app's Documents directory using:

[UIImagePNGRepresentation(image) writeToFile:path atomically:YES];
I was making these file writes fairly frequently, so I tried switching the file saving method to the one supplied in NYXImagesKit:

[image saveToPath:path type:NYXImageTypePNG backgroundFillColor:nil];
Though still not instant, this change cut down on memory usage and speeded things up sufficiently so that after adding an activity indicator during image processing, the app's responsiveness was satisfactory.
stephenbenedict is offline   0 Reply With Quote

MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

crashes, effects, image, memory, slow

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Why are backups taking up so much space on my HD? DePaulBlueDemon OS X 5 Jul 3, 2013 09:15 AM
Why are on-site backups taking up so much space? Winter Charm Mac OS X 10.7 Lion 5 Aug 22, 2012 10:40 PM
Why is my Late 2006 MBP so much SLOWER than my Power Mac G5?! Jessica Lares PowerPC Macs 11 Oct 4, 2010 07:59 PM
Why is iMovie HD taking up so much HD space? katlove Digital Video 4 Jan 20, 2009 08:48 AM
Why is kernel_task taking up so much CPU and Memory? Crawn2003 OS X 5 Dec 15, 2007 02:45 PM

All times are GMT -5. The time now is 07:30 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013,, LLC