memory management in android 3d game

Started by guillaume, December 23, 2011, 02:17:50 AM

Previous topic - Next topic

guillaume

I found dalvik vm's heap memeory is very limited, my app just use some textures and load 2 models,
and the dalvik vm throws OutOfMemoryError exception.
I am doubtl how other people implement 3d game in android, how do you manage the memory ?

EgonOlsen

That highly depends on the model and the textures as well as the target platform. My old Galaxy with 1.6 has 16mb VM memory, my Nexus S with 4. 0 has 48mb available.

What's the polygon count of your models and the size of your textures?

Some hints: http://www.jpct.net/wiki/index.php/Reducing_memory_usage

guillaume


guillaume

Quote from: EgonOlsen on December 23, 2011, 09:53:00 AM
That highly depends on the model and the textures as well as the target platform. My old Galaxy with 1.6 has 16mb VM memory, my Nexus S with 4. 0 has 48mb available.

What's the polygon count of your models and the size of your textures?

Some hints: http://www.jpct.net/wiki/index.php/Reducing_memory_usage

I am wonder if it is possible to use JNI to allocate C memory for use by jPCT or OpenglES call ? the native code will not  limit by VM.

EgonOlsen

Quote from: guillaume on December 26, 2011, 11:03:38 AM
I am wonder if it is possible to use JNI to allocate C memory for use by jPCT or OpenglES call ? the native code will not  limit by VM.
No. There's no way to access this memory with the Java OpenGL binding, which means that you would have to move these parts to native code as well. So you either have to build a complete new binding that manages this or move even engine code on the native side, which results in the engine becoming a native one. As a rule of thumb: If it doesn't fit in the VM's memory, it's to heavy for the vm/device to handle anyway. Which problem do you have exactly?

guillaume

I may have 20 3D icon ons the screen, so I am worry about the memory consumption.
but it seem like I should adopt the guide in the wiki. ;)

EgonOlsen

Shouldn't be an issue as long as not all 30 objects are unique meshes.