Memory leak on Dispose()

Topics: Bugs
Feb 9, 2012 at 10:47 AM
Edited Feb 9, 2012 at 10:48 AM

I need to delete and create a map during the life of the program, as it must always be on the screen, but always keep the memory - too expensive.
Easy to use Dispose () leads to memory leaks because of the references to events that are not removed, I've done this in
GMapControl:

      public void Dispose()
      {
          Application.Current.SessionEnding -= new SessionEndingCancelEventHandler(Current_SessionEnding);
          GMaps.Instance.CancelTileCaching();

          Core.OnMapZoomChanged -= new MapZoomChanged(ForceUpdateOverlays);
          Loaded -= new RoutedEventHandler(GMapControl_Loaded);
          Unloaded -= new RoutedEventHandler(GMapControl_Unloaded);
          Dispatcher.ShutdownStarted -= new EventHandler(Dispatcher_ShutdownStarted);

          SizeChanged -= new SizeChangedEventHandler(GMapControl_SizeChanged);

          Core.OnMapClose();
      }

Now there is a memory leak, I think the project should add something like that.

Coordinator
Feb 9, 2012 at 12:43 PM
Edited Feb 9, 2012 at 12:57 PM

and how much it leaks, 2 bytes, 3?

p.s. fixed

Feb 9, 2012 at 12:58 PM

no, in my case, these links are forced to live and fly control, and it weighs a little more.

radioman, you are from Russia? For the sake of.

Feb 9, 2012 at 12:59 PM

thanks

Coordinator
Feb 9, 2012 at 1:13 PM

i'm from old mars district called lithuania ;}