--
------
David Sauter
See the class textureStore in this file for details:
http://code.google.com/p/glesquake/source/browse/quake/src/WinQuake/gl_draw.cpp
Given that my project is well over 200MB in data alone I'd already
intended on using the SD card for data storage. The problem is that
we really do need 30+ MB of ram.
Is anyone working on a real swap system for Android? There's some
things that could get swapped out until they're needed to get us under
the 24MB limit of the Nexus but the real goal is the Droid at 16 MB.
Or is the Droid going to get the 2.1 update and thus the 24MB limit?
David Sauter
--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.
You can't use malloc, but you can use your own memory allocators to
manage the mmapped memory.
On Jan 7, 12:12 pm, David Sauter <del...@gmail.com> wrote:
> On Wed, Jan 6, 2010 at 8:26 PM, Jack Palevich <jack.palev...@gmail.com> wrote:
> > You might try using mmap to map a file on the SD card. Sort of a poor-
> > man's swap file. I did that for the texture cache in my GLESQuake port
> > and it worked fine on G1, etc.
>
> > See the class textureStore in this file for details:
>
> >http://code.google.com/p/glesquake/source/browse/quake/src/WinQuake/g...
--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.
We also need the memory for higher density geometry and textures.
> This limit was very specifically chosen as a reasonable amount of memory to
> provide to the app without it causing bad out of memory conditions for the
> rest of the system. Please don't significantly exceed it.
The problem is that this limit cripples the OS for use as a gaming platform.
> For some
> perspective: on older devices with 16MB, the web browser can grow to using
> 24MB or a little more, but when these happens it greatly restricts what can
> run in the background and thus the user experience -- for example causing
> the home app to be tossed from memory, so the next time the user goes to it
> they need to wait for it to be restarted.
Older devices don't have the GPU to handle modern games so that's not
an issue. Droid and Nexus One do.
> Also given that this is the NDK list, the limit is actually not imposed on
> you, because it is only on the Java heap. There is no limit on allocations
> in the native heap... that said, if we start to see applications take
> advantage of this to allocate significantly more memory above the value
> returned
> by http://developer.android.com/intl/fr/reference/android/app/ActivityManager.html#getMemoryClass() then
> we will probably be forced to make the platform more aggressive about
> finding and killing such apps to keep everything running well.
Which means there's no use even trying to get real gaming working on
Android. Even if we can manage to get things working right now you've
just threatened to come along with an OS update later that will kill
any process running above your arbitrary limit.
If memory is so much a bottleneck why doesn't Android have a real swap
built into the OS? Why do Nexus and Droid have the same limits when
the Nexus has twice the RAM of the Droid? Why is Droid's limit only
50% above th G1 when it's got 75% more RAM?
Unless Android 2.0 is significantly more memory intensive than 1.6 the
Droid should have 28MB heap and the Nexus a 56MB limit. At those
numbers we might be able to do something with the Droid and we can
code to the Nexus with few issues - but trying to get production
quality gaming on lower memory counts means we'll be looking like
Dreamcast era games not XBox era which is where the iPhone is.
Is there any chance we can get some OS functionality to request a
larger than getMemoryClass() value of memory and have the kernel reply
if this is possible? We can ask the user to shut off other apps
running in order to free up enough memory then make the request again
if the kernel replies in the negative. That would solve everyone's
problems.
I don't mind warning the user that a given game is going to mostly
take over the phone but I do mind it getting killed by the kernel out
from under us in a future OS update.
--
------
David Sauter
For a game, unless you're doing something seriously unusual, most of
the data you have in RAM is going to be textures, geometry, animation
data, sound. All of this can be stored in files and mmapped.
Keep the heap free for dynamic data and data that is allocated by
libraries.
Mmapped data is not going to count against your heap limit, and it's
not going to negatively affect the system performance, so it's
unlikely to cause your application to be killed for using too much
system resource.
> >> On Thu, Jan 7, 2010 at 3:27 AM, Dianne Hackborn <hack...@android.com>
> >>http://developer.android.com/intl/fr/reference/android/app/ActivityMa...()<http://developer.android.com/intl/fr/reference/android/app/ActivityMa...>
> >> android-ndk...@googlegroups.com<android-ndk%2Bunsubscribe@googlegr oups.com>
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/android-ndk?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "android-ndk" group.
> > To post to this group, send email to andro...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > android-ndk...@googlegroups.com<android-ndk%2Bunsubscribe@googlegr oups.com>
No, but unless that SD card is a lot faster than any other I've seen
you're going to hammer your frame rate by putting any data that's
being used in the rendering pipeline on it. That data alone can be
well over 20-30 MB even for small games.
The GPU on these is using that same 16/24MB heap for it's assets too.
Even if you could get the game itself (without rendering assets) to
live in 2-4 MB when was the last time you saw a 3D game that had less
than 14MB in rendering assets on the screen at once?
Not to mention the Droid is more than 2x the resolution of the iPhone.
That means you need 2x the texture resolution minimum for something
to look the as good or better than it's iPhone counterpart. You can
blow a dozen megs in texures before your artists have even blinked.
If Android is going to be taken seriously as a gaming platform we need
some way to request the system give us a much larger chunk of memory
than normal apps live in.
David Sauter
No, but unless that SD card is a lot faster than any other I've seenyou're going to hammer your frame rate by putting any data that's
being used in the rendering pipeline on it. That data alone can be
well over 20-30 MB even for small games.
The GPU on these is using that same 16/24MB heap for it's assets too.
Even if you could get the game itself (without rendering assets) to
live in 2-4 MB when was the last time you saw a 3D game that had less
than 14MB in rendering assets on the screen at once?
Why yes I did. I was going to quote it here but you reiterated
yourself in the next paragraph.
> Though, again, you do need to be careful about your memory usage or you are
> going to cause problems and in the future we may need to do something about
> that in the platform.
That right there is the problem. I'm looking at 6-7 digit budgets for
Android titles. There's no way in this world I can pour that kind of
money into a title when you've already stated that you "may need to do
something about that."
Your attitude that applications only need to use a fraction of the
power of the device when iPhone apps get to use almost all of it means
that Android will never be able to compete with iPhone as a gaming
platform.
That's the core of the problem.
Interestingly the solution is actually fairly simple. The permissions
platform already requires apps to request what resources they will
need. Adding a new one that turns off the ability of the kernel to
kill the process due to low resources but instead puts a pre-requested
hard limit on it. The rest of the phone can operate normally with
total - requested RAM until the app closes for other reasons
(obviously manual force terminate and terminate on fatal error would
have to be immune from the kernel shutoff).
At that point we can determine what phones are capable of running the
games (likely 2.0 or greater) and then go from there.
--
------
David Sauter
While I'm not an iPhone developer, I have read discussions in public
web forums that lead me to believe that iPhone app limits are actually
pretty similar to Android app limits. See this thread, for example,
where iPhone developers say they should limit their iPhone heap to
10-20MB of RAM:
http://www.iphonedevsdk.com/forum/iphone-sdk-development/6606-limit-ram-usage.html
And in this very thread you can read an iPhone developer is limiting
their apps to 32 MB of RAM.
And in this very thread you can read an iPhone developer is limiting
their apps to 32 MB of RAM.
--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.
We've got three iPhone games on the market and two more that will be
released in the next month or so. Our memory footprint on the iPhone
(with less than half the resolution to deal with) is 40+ MB.
--
------
David Sauter
So we won't be seeing future OS updates that will apply the Java limit
to NDK allocations or if we do the limit will be >= 32MB for Android
2.X phones? If we can't get a game mode in the kernel that guarantee
will still give us enough room do to slightly stripped down versions
of our iPhone games for Android as well as move forward with Android
first run titles.
--
------
David Sauter
Yes.
On top of that it was the vague 'but if you use too much we'll change
the OS to put in limits' that scared the daylights out of me.
Dainne has stated that 32MB 'should' be OK on the Android 2.X phones
(Droid and Nexus). While it'll take some retooling of our engine to
put more pressure on the CPU to take pressure off memory (since the
old iPhones had the exact opposite problem - high memory low
processor) we should be able to bring our iPhone titles to Android so
long as that 32MB soft limit is real and we don't get busted back to
24MB in a future update.
... that brings a question to mind. If 32MB is OK for NDK apps on
Droid/Nexus why isn't that the JDK limit?
--
------
David Sauter
Seems a fair point to me. The user is not going to want their phone
running like a dog because all their apps are evading the platform
limits and placing large amounts of data in RAM just so they load up
more quickly.
I think what people should really be asking for is a method of putting
the phone into a "gaming mode" profile, where the memory allocation is
more favourable to the running app, but other services and apps are
suspended to ensure the phone is not left in an unstable state.
Really, the only thing that should be active at this point is the
telephony service. This will mean no in-game SMS, email, or Web
browsing; but we are talking about maximising resources for game
performance, right?
>> So we won't be seeing future OS updates that will apply the Java limitYes.
>> to NDK allocations or if we do the limit will be >= 32MB for Android
>> 2.X phones? If we can't get a game mode in the kernel that guarantee
>> will still give us enough room do to slightly stripped down versions
>> of our iPhone games for Android as well as move forward with Android
>> first run titles.
>>
>
> I keep coming back to Dianne's previous comment that native code does not
> have these limits. Successful game developers are going to have to figure
> out how to do as much in native versus Java as possible. Yes/no?
On top of that it was the vague 'but if you use too much we'll change
the OS to put in limits' that scared the daylights out of me.
Dainne has stated that 32MB 'should' be OK on the Android 2.X phones
(Droid and Nexus). While it'll take some retooling of our engine to
put more pressure on the CPU to take pressure off memory (since the
old iPhones had the exact opposite problem - high memory low
processor) we should be able to bring our iPhone titles to Android so
long as that 32MB soft limit is real and we don't get busted back to
24MB in a future update.
... that brings a question to mind. If 32MB is OK for NDK apps on
Droid/Nexus why isn't that the JDK limit?
I've asked for something similar but I don't think a full lockout is
needed. The phone/wifi/bluetooth radios are required for any kind of
multiplayer and geolocating is required for targeted advertisement.
If all you do is allow suspend or swap out any apps that the one
requesting game mode doesn't publish intents for and the phone itself
(since you don't want to miss calls just because you are playing a
game). People aren't going to be annoyed that there's a few second
delay for the phone to come back up to speed after being in a game so
long as critical real time functionality (I.E. the phone) is still
responsive.
That combined with a promise that the kernel won't be killing your
process unless it really does run out of RAM should be more than
enough to free up the kinds of room modern top tier games need.
Especially in the Nexus with it's 512 MB of RAM.
--
------
David Sauter