Device resource usage for developers?

Discussion in 'Public Game Developers Forum' started by wildex999, May 2, 2009.

  1. wildex999

    wildex999 Member

    Apr 12, 2009
    11
    0
    0
    Student
    Norway
    Hello,
    I'm thinking of getting myself an iPod Touch and start developing games for it. I have allready played around inside the simulator, and it seems simple enough.
    I have also read up on what kind of power the iPhone and iPod have, 400-533Mhz CPU and 128MB RAM. But from reading around, I have seen that you apparently don't get to use all of this in your app/game, like you would on a normal gaming console. So my question is: How much of an iPhone/iPod's resources can an App/Game use? I have read here and there that some apps can't use more than 20-40MB RAM, something that is bothering me, because games, especially 3D games, need a bit of RAM to store models, audio and textures.

    Anyone have any answer to this?

    Thanks in advance :)
     
  2. WellSpentYouth

    WellSpentYouth Well-Known Member

    Jan 11, 2009
    1,363
    0
    0
    iPhone programmer
    App Tech Studios, USA
    I am not 100% sure, but I think that you get around 40mb like you said. Maybe less.
     
  3. wildex999

    wildex999 Member

    Apr 12, 2009
    11
    0
    0
    Student
    Norway
    Thanks for the answer WellSpentYouth :)
    What will the device do if you should try to allocate more RAM than this? Will it fall back to some swap-file, like Windows does, or will it just crash/fail to allocate?
    And what is happening to the other 88MB of RAM?
    The iPhone/iPod Touch seemed so powerfull when I first started reading about it, but these limitations seems to be able to cripple any big games from running =/
     
  4. bovinedragon

    bovinedragon Well-Known Member

    Sep 20, 2008
    98
    0
    0
    #4 bovinedragon, May 2, 2009
    Last edited: May 2, 2009
    From apple's Technical Note TN2230: "OpenGL ES applications should use no more than 24 MB of memory for both textures and surfaces."

    Also from same document: "The virtual memory system on iPhone OS does not use a swap file. When a low-memory condition is detected, instead of writing volatile pages to disk, the virtual memory frees up nonvolatile memory, to give your running application the memory it needs. This further means that memory allocation is more critical on iPhone OS than on Mac OS X, and you must strive to use as little of memory as possible." It tries to deallocate as much as it can from other apps like safari and mail, but that can only get you so much.

    You can try to allocate more than this, but you risk the system running out of memory, and your app crashing. Keep in mind that the iPhone actually runs a mini version of OSX, and I would guess that takes up a bunch of the memory. I bet it keeps a lot of textures allocated for all the UI, text, and app icons too.
     
  5. Eric5h5

    Eric5h5 Well-Known Member

    Crash. There's no swap space; you would not want to do that with flash RAM.

    Used by the OS and possibly Apple apps (like Safari), which are the only apps that can stay in RAM when closed.

    You don't have to try to load the whole thing into RAM at once. There are games (only a few so far to be sure) using 100s of megabytes. The PS2 has 32MB RAM, which doesn't prevent it from running big games.

    --Eric
     
  6. wildex999

    wildex999 Member

    Apr 12, 2009
    11
    0
    0
    Student
    Norway
    #6 wildex999, May 2, 2009
    Last edited: May 2, 2009
    Thanks for your answers bovinedragon and Eric5h5. :)

    I guess I still could make my own swap-file(EDIT: oh wait, you mentioned that, flash RAM, should not be written/read too much?)? Also, as you said Eric5h5, big games can still run. Using something like Chunked LOD, I could in theory have 100's of megabytes of terrain and map data, and just load in what is needed where I am.
    Well, just adds to the challenge I guess :p

    Also I take it that since the RAM is shared, so is the CPU? Do the iPhone/iPod prioritize the currently "running" app for CPU usage?
     
  7. Eric5h5

    Eric5h5 Well-Known Member

    Writing to flash RAM destroys it over time...not enough to worry about in day to day usage, but if you were to treat it like a hard drive and use virtual memory, it would die fairly quickly.

    Running services in the background does use up some CPU cycles.

    --Eric
     
  8. wildex999

    wildex999 Member

    Apr 12, 2009
    11
    0
    0
    Student
    Norway
    Ok, thanks :) You have all been a lot of help :)
     

Share This Page