Camera view memory usage

Discussion in 'iOS Programming' started by mademo, Aug 12, 2008.

  1. mademo macrumors newbie

    Joined:
    Aug 12, 2008
    #1
    Hi all,

    I'm using the camera view within my app to take pictures. Very often either when taking the picture or saving it, I get a mem warning that makes the application to terminate. I know that the camera view + saving the photo brings the mem usage suddenly up to 17,5 MB. I'd like to know if any of you guys experienced a similar issue as well and any potential solution to the problem.

    Thanks a lot!
     
  2. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    Hm, I've been experiencing crashes when using the camera, and haven't figured out why yet (haven't really looked into it much, and crash logs are worthless). If the camera is taking a lot of memory, I'd suggest just prepare your app to release heavy objects before you use the camera, and then after the camera is done being used, load back your objects.
     
  3. mademo thread starter macrumors newbie

    Joined:
    Aug 12, 2008
    #3
    Hi,

    by using Instruments > Activity Monitor I figured out that the process of taking and saving photos takes up to 20+ MB. I need to implement a smart memory management in order not to make my app run out of memory, hence crash (since an app is allocated by iPhone OS at most 30 MB from what I see).

    BTW, it is really a bummer that the camera eats up so much memory. This limits somewhat an app and forces people to put in place all the possible tricks to manage every single byte of memory.
     
  4. Ron C macrumors member

    Joined:
    Jul 18, 2008
    Location:
    Chicago-area
    #4
    (me == noob)?

    I hate to be such a noob weenie, but when you say "camera view," are you talking about using the camera on the device? How exactly might one go about doing that? I've been looking at bits of the sample code trying to figure that out without much luck. (Oh, I searched here too before I dropped this in here, hopeful someone may grace me with a bit of assistance.)

    I have an app idea where I'd like to use the camera to take a picture of something then do something with that image.

    Thanks!

    Ron C
     
  5. Taum macrumors member

    Joined:
    Jul 28, 2008
    #5
    Check out the video on the iPhone developer connection : "Using iPhone features in your application" (from approximately 3:10 to 5:10).
     
  6. Ron C macrumors member

    Joined:
    Jul 18, 2008
    Location:
    Chicago-area
    #6
    Thanks, I'll do that.

    I also stumbled across UIImagePickerController (say "Thank you" to Terminal and grep - being old^h^h^hexperienced has some advantages) and found a nice tutorial via a google search.

    Ron C
     

Share This Page