Limiting GPU memory for saving textures on Android and iOS devices

I am building an Android based application Open GL ES 3.0

that needs to serve a wide range of devices.

Due to some requirements in my application, I have to store a lot of image data in RAM while my application is running. Since Android phones have a CPU memory limit or a limit on heap memory size

, I decided to store my required image data as textures on the GPU while my application is running.

The size of my texture 1024x1024

. Saving textures and displaying them back when required works great to implement it.

But I soon realized that GPU memory has similar limitations (as it seems). I can only save an 1024x1024x50

approximate amount of textures on the Sony XPeria Z5. 1024x1024x70

texture on another Sony XPeria series. 1024x1024x90

on Huawei P8, etc.

Also, I found that there is a limitation on textures

/ GPU memory

on devices iOS

. I cant save more textures 1024x1024x90

on iPhone 6+

!!

The numbers here are not accurate, but quite close. My goal to pose this question is to get an idea of how much GPU memory is available to an application on Android devices. ...

Does android GPU memory provide CPU memory related app somehow as shown in this one here ?

Android apps can query large heap

using a property declared in the manifest. Likewise, Is there a way that I can request additional GPU memory for my application?

Are the textures actually stored in GPU memory or is part of it also stored in CPU memory?

Any information related to GPU memory limitation on iOS devices along with android would be helpful.

+3


source to share


1 answer


I think that all the devices you are connected to share the same memory, which means you don't have to worry about the difference between GPU and CPU memory. From your point of view, it is best to think of it as the same pool of RAM.

Android apps can request a large heap using a property declared in the manifest. Likewise, is there a way that I can request more GPU memory for my application?

The big heap is about Java distribution. If you write your own code (many iOS and Android apps have most of their code in C ++), then this may not really matter.

You can see how much memory different iOS devices have here .

For Android, you can look here to see compatibility definitions. For example, devices without watches that support Marshmallow have at least 512MB.



You can determine how much memory textures you need by assuming 32-bit 8888 and no mipmaps, each texture is 1024 * 1024 * 4 bytes = 4MB (please update the question if these assumptions are wrong!). Sony XPeria Z5 with 50 of them dies in about 200MB. Huawei P8 and iPhone6 ​​+ die at 360MB.

You shouldn't expect to be able to use anywhere near RAM on a smartphone. There is an OS and other applications to run, and there is no memory-based virtual memory that you would see on desktop OSs. Typically, you can expect to use about 30% -50% of the system's RAM before the OS shuts down your application. iOS definitely, and I believe Android sends alerts about your app too when your memory usage gets too high.

The reverse shell math works right on the iPhone6 ​​+ (1GB RAM, you can use 360MB), but the Sony XPeria Z5 and Huawei P8 have a whopping 3GB of RAM. TBH, I have no idea why you might use so little.

EDIT: Also, working in the debugger adds a significant memory overhead, but I don't feel it can explain the missing GB on these Android devices.

+2


source







All Articles