Author Topic: memory management in android 3d game  (Read 1926 times)

Offline guillaume

  • int
  • **
  • Posts: 67
    • View Profile
memory management in android 3d game
« 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 ?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12092
    • View Profile
    • http://www.jpct.net
Re: memory management in android 3d game
« Reply #1 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

Offline guillaume

  • int
  • **
  • Posts: 67
    • View Profile
Re: memory management in android 3d game
« Reply #2 on: December 26, 2011, 01:39:02 am »
thanks. I will look the link.

Offline guillaume

  • int
  • **
  • Posts: 67
    • View Profile
Re: memory management in android 3d game
« Reply #3 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

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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12092
    • View Profile
    • http://www.jpct.net
Re: memory management in android 3d game
« Reply #4 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?

Offline guillaume

  • int
  • **
  • Posts: 67
    • View Profile
Re: memory management in android 3d game
« Reply #5 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. ;)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12092
    • View Profile
    • http://www.jpct.net
Re: memory management in android 3d game
« Reply #6 on: December 28, 2011, 08:46:08 pm »
Shouldn't be an issue as long as not all 30 objects are unique meshes.