Need help figuring out if our developer knows what he's doing

Discussion in 'iOS Programming' started by elpaproduction, Mar 16, 2011.

  1. elpaproduction macrumors newbie

    Mar 16, 2011

    We're developing our first Iphone application and we're using a developer from elance.

    The simple app is taking way too long and over budget and I need help figuring out whether it's our developers fault or ours.


    App has 2 States. State 1 (full screen animation with 50 PNGs), State 2 (full screen animation with 90 PNGs). When the user presses on the screen while in State 1, the app should change from State 1 to State 2. Once the animation finishes, the app then goes back to State 1. Cycle repeats (if user chooses to)

    Problem: Our app runs out of memory. Our full-screen PNGs are huge (690K for each PNG in 640X960 and 225K for 320X480)

    Proposed solution by our developer: Re-do the PNGs by taking out the background (since it's static) and some small other elements, leaving just the main character in each PNG.

    Our designer says that if she makes the background transparent and saves the PNG, the physical size of the PNG doesn't get any smaller, since our main character is pretty much the size of the screen.

    Before I pay our designer to take out the background from 140 PNGs (50 for state 1 +90 for state 2), I need to know whether this is going to work.

    What are your thoughts?

    Any input will be highly appreciated,

  2. KnightWRX macrumors Pentium


    Jan 28, 2009
    Quebec, Canada
    Your developer shouldn't keep all the PNGs loaded into memory and only have the current one that's displayed loaded (and do some caching of a few upcoming ones, like 2 or 3 for performance reasons during switching).

    From your quick summary of the situation, that's about the only problem I can see.

    Otherwise, you're going to have to show us the code he's written.
  3. elpaproduction thread starter macrumors newbie

    Mar 16, 2011
    Thanks! So if our developer is not doing that already - would you consider that a blunder on his part?
  4. elpaproduction thread starter macrumors newbie

    Mar 16, 2011
    After talking to our developer, We are already buffering two to three images ahead, else we get a flicker as frames change (most evident on iphone 4 where we are loading larger images).
  5. PhoneyDeveloper macrumors 68040


    Sep 2, 2008
    The amount of memory taken up by images in-memory is dependent on the dimensions of the image, not the size of the image on disk. x*y*4 is the amount of ram png and jpeg images take up. Any device should be able to hold several full screen images in memory at a time. But maybe not much more than that.

    Anyway, it should be possible to test this out with just a single image with transparency. Just use the same image 90 times with the proposed changes and see if it fixes things.

    Also, there are pretty good Instruments that tell you where the memory usage is. If you make a change you should be able to see in the Instruments if it results in less memory usage or not. Does crash or doesn't crash is kind of a blunt tool.
  6. chown33 macrumors 604

    Aug 9, 2009
    Sailing beyond the sunset
    Then we probably need to see the code.

    There are two UIImage methods for loading images. One caches (+imageNamed:); the other doesn't (+imageWithContentsOfFile:). If the code is using the caching method, then all the past images will likely be in memory, in the cache. Caching past images seems to be counterproductive for this app, so should be avoided. But without seeing code, that's just a guess about the problem and its solution.

    BTW, exactly how long has "way too long" been? Give the number of calendar days that you expected, that you contracted for, and that have actually elapsed.
  7. dejo Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State
  8. firewood macrumors 604

    Jul 29, 2003
    Silicon Valley
    Lots of developers seem to have problems with memory issues when dealing with lots of big images. However, more experienced or better developers have more tricks for working around memory issues. However the proper or best trick might be different ones for different apps. The catalog recommended by Apple includes caching, tiling, layering, mip-mapping, and more.

    The first thing I would try is some brut force testing to make sure there is nothing else wrong with your app (e.g. is your developer sand bagging?). Try reducing all your image files to 32x48 (100x to 400x smaller). It might not look great, but if your dev can't make that work, you have bigger problems.

    It is also possible that you have over-specified some detail that is just impossible for current hardware.
  9. PhoneyDeveloper macrumors 68040


    Sep 2, 2008
    @firewood. Dealing with lots of big images is a problem, no matter how you slice it. All the solutions are compromises. It can take a while to devise the correct solution for a given app.
  10. firewood macrumors 604

    Jul 29, 2003
    Silicon Valley
    The efficiency of the solution(s) will affect the amount of the compromise(s) required.
  11. 1458279 Suspended


    May 1, 2010
    I don't know the name of the function, but what about that one that compresses the images? I just watched the vid on that the other day, it compresses at two different levels and saves a HUGE amount of ram.

    The vid is part of Apples WWDC 2010 I think, and they show pictures with and without compression, hard to tell the difference.

    I'd be curious as to what they charge and how the contract is setup. I googled it and several came up with 'SCAM' saying how it took longer, cost more...
    How much longer and how much more is it costing?

    I've seen it done many times... under bid an hourly contract, sandbag for more money... One company I worked at went out of business because of this and it should have been caught before that happened.

    If you can post some code and some details about costs/time etc... we can be of more help.
  12. RonC macrumors regular

    Oct 18, 2007
    Which problem are we addressing?

    Problem 1:
    Problem 2:
    Problem 1 is outside my scope, but it's good that you ask the question in a form where it could actually be your fault.

    Problem 2 is more in my ballpark - are you sure there are no memory leaks? Leaks @ 690K+ per frame add up pretty quickly...

    Ron C
  13. (marc) macrumors 6502a


    Sep 15, 2010
    the woods
    +1, that's important to know!

Share This Page