Memory leak on Dispose()

Topics: Bugs
Feb 9, 2012 at 11:47 AM
Edited Feb 9, 2012 at 11: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

      public void Dispose()
          Application.Current.SessionEnding -= new SessionEndingCancelEventHandler(Current_SessionEnding);

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


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

Feb 9, 2012 at 1:43 PM
Edited Feb 9, 2012 at 1:57 PM

and how much it leaks, 2 bytes, 3?

p.s. fixed

Feb 9, 2012 at 1: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 1:59 PM


Feb 9, 2012 at 2:13 PM

i'm from old mars district called lithuania ;}