★ TouchArcade needs your help. Click here to support us on Patreon.

Device resource usage for developers?

05-02-2009, 01:03 PM
#1
Joined: Apr 2009
Location: Norway
Posts: 11
Device resource usage for developers?

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

Soon to be iPhone/iPod Touch game developer!
05-02-2009, 01:10 PM
#2
Joined: Jan 2009
Location: App Tech Studios, USA
Posts: 1,363
Quote:
Originally Posted by wildex999 View Post
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
I am not 100% sure, but I think that you get around 40mb like you said. Maybe less.

05-02-2009, 01:29 PM
#3
Joined: Apr 2009
Location: Norway
Posts: 11
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 =/

Soon to be iPhone/iPod Touch game developer!
05-02-2009, 03:14 PM
#4
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.

Kevin Calderone - @bovinedragon
Trace 2 is Out!

Last edited by bovinedragon; 05-02-2009 at 03:18 PM.
05-02-2009, 03:14 PM
#5
Quote:
Originally Posted by wildex999 View Post
What will the device do if you should try to allocate more RAM than this?
Crash. There's no swap space; you would not want to do that with flash RAM.

Quote:
And what is happening to the other 88MB of RAM?
Used by the OS and possibly Apple apps (like Safari), which are the only apps that can stay in RAM when closed.

Quote:
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 =/
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

Realmaze3D on the App Store
Realmaze3Free: 3 free mazes (a taste of Realmaze3D)
05-02-2009, 04:26 PM
#6
Joined: Apr 2009
Location: Norway
Posts: 11
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?

Soon to be iPhone/iPod Touch game developer!

Last edited by wildex999; 05-02-2009 at 04:31 PM.
05-02-2009, 05:19 PM
#7
Quote:
Originally Posted by wildex999 View Post
(EDIT: oh wait, you mentioned that, flash RAM, should not be written/read too much?)
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.

Quote:
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?
Running services in the background does use up some CPU cycles.

--Eric

Realmaze3D on the App Store
Realmaze3Free: 3 free mazes (a taste of Realmaze3D)
05-02-2009, 05:25 PM
#8
Joined: Apr 2009
Location: Norway
Posts: 11
Ok, thanks You have all been a lot of help

Soon to be iPhone/iPod Touch game developer!