www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: guillaume on December 23, 2011, 02:17:50 am

Title: memory management in android 3d game
Post by: guillaume on December 23, 2011, 02:17:50 am
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 ?
Title: Re: memory management in android 3d game
Post by: 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 (http://www.jpct.net/wiki/index.php/Reducing_memory_usage)
Title: Re: memory management in android 3d game
Post by: guillaume on December 26, 2011, 01:39:02 am
thanks. I will look the link.
Title: Re: memory management in android 3d game
Post by: guillaume on December 26, 2011, 11:03:38 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 (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.
Title: Re: memory management in android 3d game
Post by: EgonOlsen on December 26, 2011, 08:48:19 pm
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?
Title: Re: memory management in android 3d game
Post by: guillaume on December 27, 2011, 02:59:38 am
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. ;)
Title: Re: memory management in android 3d game
Post by: EgonOlsen on December 28, 2011, 08:46:08 pm
Shouldn't be an issue as long as not all 30 objects are unique meshes.