Stability on mobile

Aug 25, 2010 at 2:33 PM

The KiberTileCache.RemoveMemoryOverload() gets problem on retrieving 'm.Length' if m is disposed. In worst case it may loop until memory cache is completely emptied since 'memoryCacheSize' is not reduced.

 My scenario is as follows:

Heavy panning/zoom may result in out-of-memory exception when creating new Bitmap(stream) in WindowsFormsImage.FromStream. This method will then dispose the stream and return null. When GMaps.GetImageFrom(..) receive null it will also dispose the same stream.  I suspect it's wrong to dispose the cached stream here as it will cause problems for KiberTileCache.

 Agree?     (I know. It’s more to this...)


GmapControl.ToImage() is not yet implemented for mobile. It can easily be done like this:

      public Image ToImage()
         Image ret = null;
#if PocketPC
         if (backBuffer != null)
           return (Image)backBuffer.Clone();


Aug 25, 2010 at 4:51 PM

i see.., just i'm in the core these days, but i'll check what can be done in mobile front too ;}

Sep 7, 2010 at 2:11 PM

My mobile is now stable! YES!!!

 The stability issues where all related to memory load. After some modification to reduce memory peaks it’s really stable in all modes and for all tile types. Performance is still acceptable. Here is what I’ve done:

  • Trim Matrix, clear tileLoadQueue and FailedLoads upon panning when tileLoadQueue is not empty. (As shown below.) Vital when panning repeatingly.
  • Clear completly tileLoadQueue, Matrix and FailedLoads upon zoom.
  • Keep only current zoom level in matrix (LevelsKeepInMemmory = 0)
  • Add limitation for maximum number of tiles (100) in KiberTileCache in addition to existing size limit. To prevent huge collections when tiles are small.
  • Add limitation for max number of entries in tileCacheQueue (100). This was unlimited.




      void UpdateBounds()

            lock (tileLoadQueue)
#if PocketPC
               if (tileLoadQueue.Count > 0)
                  tileLoadQueue.Clear();  // !
                  Matrix.ClearLevelAndPointsNotIn(zoom, tileDrawingList);
                  lock (FailedLoads)

 btw. How should i delete from cache DB. Is it sufficient to execue "DELETE FROM Tiles WHERE Type=1234" or do I have delete from TilesData table as well?



Sep 7, 2010 at 2:23 PM

deleting is cascaded, so you use just Tiles table, and about stability, i think it's depends on what hardware you use, on my mobile it's quite stable already, but maybe your points stabilizes it even more, but i can't test it well ;/

p.s. ..and now i'm implementing rotation on windows forms and loading threads locking isn't working on mobile, for a while newest changesets will be unusable and untestable for mobile ;/

Sep 7, 2010 at 2:45 PM

no problem ;)

Sep 7, 2010 at 5:19 PM

i'll focus on mobile later ;}

Sep 20, 2010 at 12:32 PM

Hi radioman...

How is going?

Any progress on mobile version?

I'm getting out of memory error on windows ce 6.0 and I need somehow to fix it.I added sthex suggestions but no chages! Any ideas how to solve this problem?

Sep 20, 2010 at 1:25 PM

any debug log, stacktrace?