Author Topic: memory issues  (Read 4368 times)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: memory issues
« Reply #15 on: October 18, 2010, 01:30:13 pm »
BTW: Are you using 16bit textures or 32bit?

Offline raft

  • quad
  • ******
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: memory issues
« Reply #16 on: October 18, 2010, 01:40:54 pm »
Code: [Select]
@Override
protected void onPause() {
super.onPause();
Log.i(LOG_TAG, "onPause");

// omited irrelevant code
mGLView.onPause();

if (wakeLock.isHeld())
wakeLock.release();

if (renderer.buffer != null)
renderer.buffer.freeMemory();
}


@Override
protected void onStop() {
super.onStop();
Log.i(LOG_TAG, "onStop");
//renderer.stop();
if (renderer.buffer != null)
renderer.buffer.freeMemory();
}

i dispose FrameBuffer at two locations: in Renderer.onSurfaceChanged(..) and in Activity.onCreate(..) if last activity instance is not null

for texture bits i'm not sure. if you are asking if i'm calling Texture.enable4bpp(..), i do not.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: memory issues
« Reply #17 on: October 18, 2010, 01:45:25 pm »
for texture bits i'm not sure. if you are asking if i'm calling Texture.enable4bpp(..), i do not.
It's 32bit then...maybe going to 16bit helps!?

Offline raft

  • quad
  • ******
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: memory issues
« Reply #18 on: October 18, 2010, 01:57:48 pm »
yes, calling Texture.enable4bpp(true); helped ;D
what is exactly happening here ? do we just lower memory usage ?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: memory issues
« Reply #19 on: October 18, 2010, 02:05:04 pm »
Textures use half the memory then but it might introduce color banding. I've never noticed it unless i explicitly watched out for it.

Offline raft

  • quad
  • ******
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: memory issues
« Reply #20 on: October 18, 2010, 02:54:39 pm »
i see. so we still dont know the source of the problem. we just lowered memory usage

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: memory issues
« Reply #21 on: October 18, 2010, 05:03:10 pm »
If you are coming close to Dalvik's memory limit (and you obviously do...) especially native memory reservations start to act crazy. As said, i had similar issues when loading images (which seems to use some native memory internally). Behavior was unpredictable...sometimes it worked, sometimes it failed. Googling the issue resulted in similar problems all over the place but no real solution... :(
The compact()-method in the memory helper is the result of this...

However, i can still bring memory usage down by 0-1MB and i'll add that to the next version. In addition, you could prevent textures used for blitting only from using mipmapping, if you haven't already done that.

Offline raft

  • quad
  • ******
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: memory issues
« Reply #22 on: December 17, 2010, 01:57:18 am »
all these fixes perform very well. i'm using a skybox with six 512x512 textures and didnt get any out of memory yet ;D