Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - buiminhhuy

#1
Thanks sir very much, I have been test again, trust my problem that cause memory leaks of Bitmap.
#2
i think i will use OpenGlES for draw street of me. Because Texture i can not free memory.
#3
Quote01-31 01:49:08.209: INFO/StreetsDrawable(26528): Begin Draw Streets
01-31 01:49:08.219: INFO/StreetsDrawable(26528): 0----0
01-31 01:49:08.219: INFO/StreetsDrawable(26528): -279-----77
01-31 01:49:08.219: INFO/StreetsDrawable(26528): -1161-----222
01-31 01:49:08.219: INFO/StreetsDrawable(26528): The End Draw Streets
01-31 01:49:08.529: INFO/jPCT-AE(26528): Loading Texture...
01-31 01:49:08.569: DEBUG/lib_locapi(4670): loc_eng_report_status: GPS_STATUS_SESSION_BEGIN
01-31 01:49:08.679: DEBUG/dalvikvm(26528): GC_FOR_MALLOC freed 791 objects / 39288 bytes in 154ms
01-31 01:49:08.699: INFO/dalvikvm-heap(26528): Grow heap (frag case) to 21.244MB for 1048592-byte allocation

I can not understand why sometime Grow heap is increase when draw street, sometime  Grow heap is not increase . although I have been free memory of bimap and manager texture the same than every time draw street.
#4
Thanks, i have been resolve my problem. No WARNING load texture and No Group heap is always increase.

Thanks  EgonOlsen very much.(sory because not read JavaDoc clearly). Thanks sir this days.
Thanks  Thomas very.

I have bean resolve my problem with snip code below:
QuoteDrawable 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;
                    
QuotestreetsTexture = new Texture(BitmapHelper.rescale(bitmap, 256, 256));   
streetsTexture.setMipmap(true);
                    freeBitmap(bitmap);
                    if(tm.containsTexture("streets")){
                       tm.removeAndUnload("streets",fb);
                       tm.replaceTexture("streets",streetsTexture);
                    }else{
                       tm.addTexture("streets", streetsTexture);
                    }                  
#5
oh, it is image create dynamic. create runtime
#6
i dont see any method of texture in javadoc about resize or setsize of Texture. Can you help me? Thanks.
#7
QuoteDrawable 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.removeAndUnload("streets",fb);
                       tm.replaceTexture("streets",streetsTexture);
                    }else{
                       tm.addTexture("streets", streetsTexture);
                    }                  
               

I have been use above snip code, and resize image 250x250. However sometime get error below
QuoteGrow heap (frag case) to xxxxMB for xxxx-byte allocation
xxxx is number memory  increase than every time draw invalidate streets.
Current, i only use this solution(draw image: paint streets of the real world into image based on address GPS Location).But get problem about memory. I can not resize image smaller, because it had been picture not clearly.(if Solution any can, i hoped that it could keep size of image is 500x500, if 1000x1000 that is good.)

Thanks Sir.

P/S: I do not know to make any way to resolve the problem memory. Please! help me?.
#8
I try use image import on texture with size 250x250, problem Group heap is always increase not happen.
However Load Texture is always WARNING.
Quote01-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...

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.
#9
Quote01-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

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

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);
      }

   }

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