jPCT-AE - a 3d engine for Android > Support

ERROR/dalvikvm-heap(6950): Out of memory on a 1048592-byte a

(1/4) > >>

buiminhhuy:

--- Quote ---01-29 12:28:34.558: ERROR/dalvikvm-heap(6950): Out of memory on a 1048592-byte allocation.
01-29 12:28:34.558: INFO/dalvikvm(6950): "GLThread 12" prio=5 tid=9 RUNNABLE
01-29 12:28:34.558: INFO/dalvikvm(6950):   | group="main" sCount=0 dsCount=0 s=N obj=0x460069c0 self=0x37e000
01-29 12:28:34.558: INFO/dalvikvm(6950):   | sysTid=6972 nice=0 sched=0/0 cgrp=default handle=3409408
01-29 12:28:34.558: INFO/dalvikvm(6950):   | schedstat=( 33403747505 41698944175 45115 )
01-29 12:28:34.558: INFO/dalvikvm(6950):   at com.threed.jpct.Texture.loadTexture(Texture.java:~754)
01-29 12:28:34.558: INFO/dalvikvm(6950):   at com.threed.jpct.Texture.loadTexture(Texture.java:667)
01-29 12:28:34.558: INFO/dalvikvm(6950):   at com.threed.jpct.Texture.<init>(Texture.java:175)
01-29 12:28:34.558: INFO/dalvikvm(6950):   at com.splendor.app.directions.ar.ARDirectionsRenderer.onDrawFrame(ARDirectionsRenderer.java:99)
01-29 12:28:34.558: INFO/dalvikvm(6950):   at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1341)
01-29 12:28:34.558: INFO/dalvikvm(6950):   at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1118)
01-29 12:28:34.558: ERROR/dalvikvm(6950): Out of memory: Heap Size=16647KB, Allocated=13817KB, Bitmap Size=7275KB

--- End quote ---

Group heap is always increase

--- Quote ---01-29 12:28:04.758: INFO/jPCT-AE(6950): Loading Texture...
01-29 12:28:04.758: INFO/jPCT-AE(6950): [ 1296278884762 ] - WARNING: Unsupported Texture width (1000)...resizing to 512...
01-29 12:28:04.898: INFO/dalvikvm-heap(6950): Grow heap (frag case) to 19.895MB for 1048592-byte allocation

01-29 12:28:31.688: INFO/jPCT-AE(6950): Loading Texture...
01-29 12:28:31.688: INFO/jPCT-AE(6950): [ 1296278911692 ] - WARNING: Unsupported Texture width (1000)...resizing to 512...
01-29 12:28:32.168: INFO/dalvikvm-heap(6950): Grow heap (frag case) to 20.895MB for 1048592-byte allocation

--- End quote ---

although I have freed memory of bimap in my snip my code

--- Quote ---@Override
   public void onDrawFrame(GL10 arg0) {
      try {
         if (!stop) {   
            setCameraOrientation(mOrientationValue);
            if(mSteps!=null){
               List<GeoLocation> lsGeo=checkSteps(mSteps, mCurloc, IMG_WIDTH);
               Drawable streets;
               streets= new StreetsDrawable(lsGeo);               
               Bitmap bitmap = Bitmap.createBitmap(IMG_WIDTH,
                       IMG_HEIGHT, Bitmap.Config.ARGB_8888);
                 Canvas c = new Canvas(bitmap);
                 streets.draw(c);
                 Texture streetsTexture = null;
                 streetsTexture = new Texture(bitmap);
                 streetsTexture.setMipmap(true);
                 if (bitmap != null) {   
                     bitmap.recycle();       
                     bitmap = null;   
                     System.gc();
                      }
                 if(tm.containsTexture("streets")){
                    tm.removeTexture("streets");
                 }
               tm.addTexture("streets",streetsTexture);
               c=null;
               streetsTexture=null;
               System.gc();
               
               streets=null;
               mSteps=null;
               lsGeo=null;
            }
            
            fb.clear(back);
            world.renderScene(fb);
            world.draw(fb);
            
            fb.display();

         } else {
            if (fb != null) {
               fb.dispose();
               fb = null;
            }
         }
      } catch (Exception e) {
         Logger.log(e, Logger.MESSAGE);
      }

   }

--- End quote ---

Why is Memory always increase? Can you help me?
Thanks for Avandce!

EgonOlsen:
All your textures seem to be in non-power-of-2-formats with 1000*something. This increases memory usage at load time because it forces a rescale on each loading. Try to scale them down to 512*512 instead before loading them. The automatic rescale has been removed from latest version anyway. How many textures are you using? Keep in mind that Dalvik's memory is pretty limited.

buiminhhuy:
I try use image import on texture with size 250x250, problem Group heap is always increase not happen.
However Load Texture is always WARNING.

--- Quote ---01-30 01:17:43.201: INFO/jPCT-AE(12715): Loading Texture...
01-30 01:17:43.201: INFO/jPCT-AE(12715): [ 1296325063209 ] - WARNING: Unsupported Texture width (250)...resizing to 128...

--- End quote ---

My aplication is alway draw invalidate streets image(base on Location GPS calculated my scale) in OnDrawFrame every time Location Provider Change.

Thanks Sir for helped me.

EgonOlsen:
250 is NO power of 2. Using this size will fail on any newer version of jPCT-AE.

EgonOlsen:
Btw: If want to replace a texture in the manager with another one using the same name, simply use the replace-method. What you are doing causes copies of the textures Being left in gpu memory and objects that use the texture "streets" will be painted all white after that. They don't get the information that their texture had changed this way. I think we recently had another thread dealing with this too.

Navigation

[0] Message Index

[#] Next page

Go to full version