venkivenkat / osmdroid

Automatically exported from code.google.com/p/osmdroid
0 stars 0 forks source link

OutOfMemory when loading Tiles from Network or Cache #353

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When Running OSMDROID on low Performance Phones with small RAM like HTC 
Wildfire i get OutOfMemory Exceptions and some tiles wont be displayed.
It seems that the Bitmap Memory runns full on all Android 2.x Devices.

The error hits also Android 4.x Devices but without Exceptions in the Log. All 
Tiles are loaded from Network or the inside osm cache.

I know that my App consume some dalvik-heap memory and bitmap memory too. But 
maybe how that can be optimized in OSM-DROID ?

Sometimes the erro occures and sometimes not. When i change zomm level the 
tiles lower could be loaded. I will try to append an Example Tomorrow.

Using OSM-DROID Repository Version r1103.

Original issue reported on code.google.com by arne.koe...@gmail.com on 28 Jun 2012 at 3:44

GoogleCodeExporter commented 9 years ago
Let's try not to make too many OOME issues

Original comment by neilboyd on 29 Jun 2012 at 7:06

GoogleCodeExporter commented 9 years ago
I have done some little improvements and now fixed the OOME Problem.

Changes if done:
Class MapTileProviderBase Inner class ZoomInTileLooper and ZoomOutTileLooper 
Method handleTile()

The Line were the Bitmap will be created, i changed the BitMap Config.
Bitmap.createBitmap(pTileSizePx, pTileSizePx, Bitmap.Config.RGB_565); //  // 
KMT EXTENSION ARGB_8888 

Next Improvement: Class BitmapTileSourceBase.getDrawable(...) both Methods

final BitmapFactory.Options options = new BitmapFactory.Options(); // KMT 
EXTENSION
options.inTempStorage = new byte[131072];   // maybe 32768 is enough
final Bitmap bitmap = BitmapFactory.decodeFile(aFilePath, options);

With these improvements i had no more OOME on a range of different devices.

But there is another Problem.
When i Zoom In or Zoom Out it could happen that some tiles wont be shown.
A black tile or an loading tile placeholder will occure but will never 
disappear.
This is very frustrating. Sometimes the map has a lot of black tiles.
And even when i move arround the map and go back to where a tile was black 
befor. The same tile will be shown an black.

I think it could be an caching Problem. Or an error in Zooming In and out.

Any other Ideas ?

Original comment by arne.koe...@gmail.com on 18 Jul 2012 at 12:41