有谁知道导致此GLThread Out of Memory错误的原因是什么?

时间:2010-12-22 02:20:49

标签: android opengl-es

我得到12-21 21:19:09.384:ERROR / AndroidRuntime(4063):java.lang.OutOfMemoryError

谢谢!

@Override
public void initScene() {


    //openOptionsMenu();
    //plane = new Box(1.5f,1.5f,1.5f);
    scene.addChild(plane);


    // Create a Bitmap. Here we're generating it from an embedded resource,
    // but the Bitmap could be created in any manner (eg, dynamically).

    Bitmap b = Utils.makeBitmapFromResourceId(this, R.drawable.clouds_alpha2b);

    // Upload the Bitmap via TextureManager and assign it a 

    Shared.textureManager().addTextureId(b, "battleback", false);

    // Unless you have a specific reason for doing so, recycle the Bitmap,
    // as it is no longer necessary.

    b.recycle();

    // Create a TextureVo using the textureId that was previously added 
    // to the TextureManager ("uglysquares").

    TextureVo texture = new TextureVo("battleback");

    // Add it to the TexturesList held by the Object3d, 
    // and it will be duly rendered.

    plane.textures().add(texture);
    plane.position().y = -.5f;
    plane.position().z = 0;
    plane.position().x = 0;

    plane.rotation().y -= 60;
    skyBox.rotation().y -= 60;

    skyBox.addTexture(SkyBox.Face.All, R.drawable.clouds_alpha2b, "mytexture");

    scene.addChild(skyBox);



    IParser parser = Parser.createParser(Parser.Type.MD2,
            getResources(), "com.thinknew.androidbattle:raw/blade", true);
    parser.parse();


    revenant = parser.getParsedAnimationObject();
    //revenant.position().x = -1;
    revenant.scale().x = revenant.scale().y = revenant.scale().z = .025f;
    revenant.rotation().z = -60;
    revenant.rotation().x = -90;
    revenant.position().x = -1;
    revenant.position().z = -1;

    revenant.setFps(20);
    revenant.animationEnabled();
    revenant.play("stand", true);

    scene.addChild(revenant);


    parser = Parser.createParser(Parser.Type.MD2, 
            getResources(), "com.thinknew.androidbattle:raw/blade", true);
    parser.parse();

    fatso = parser.getParsedAnimationObject();
    fatso.scale().x = fatso.scale().y = fatso.scale().z = .025f;
    fatso.rotation().z = -250;
    fatso.rotation().x = -90;
    fatso.position().x = 1;
    fatso.position().z = 1;

    fatso.setFps(20);
    fatso.animationEnabled();
    fatso.play("stand", true);

    scene.addChild(fatso);




    Light light = new Light();
    scene.lights().add(light);

    scene.camera().position.y = 2;
    scene.camera().position.x = -2;
    scene.camera().position.z = 5;
    scene.camera().target = new Number3d(0, 1, 0);

}



12-21 21:45:18.668: ERROR/libs3c2drender(1917): int S3c2DRender::DoG2D(unsigned int, s3c_img*, s3c_rect*, unsigned int, s3c_img*, s3c_rect*, int, int)::S3C_G2D_ROTATOR_18176 fail
12-21 21:45:50.763: ERROR/PowerManagerService(1917): CurLock p:3 mPS:1
12-21 21:45:50.763: ERROR/PowerManagerService(1917): type=SCREEN_DIM_WAKE_LOCK           'StayOnWhilePluggedIn Screen Dim' active (minState=1)
12-21 21:45:50.763: ERROR/PowerManagerService(1917): type=PARTIAL_WAKE_LOCK              'StayOnWhilePluggedIn Partial' active (minState=0)
12-21 21:47:08.768: ERROR/libs3c2drender(1917): int S3c2DRender::DoG2D(unsigned int, s3c_img*, s3c_rect*, unsigned int, s3c_img*, s3c_rect*, int, int)::S3C_G2D_ROTATOR_18176 fail
12-21 21:47:58.468: ERROR/dalvikvm-heap(4414): Out of memory on a 27232-byte allocation.

1 个答案:

答案 0 :(得分:0)

您应该尝试使用Dalvik Debug Monitor,特别是 VM堆分配跟踪器部分。这将为您提供有关正在发生的事情的更多信息。