GC Collect in ProcessLoadTask - Performance Question

Apr 23, 2010 at 10:47 AM
Edited Apr 23, 2010 at 11:40 PM

After upgrading to .NET 4 and the most recent trunk of GMap.NET for WPF I've noticed lots of performance 'lag' in my application.  I use an external GPS to update my map's center and after starting the Visual studio 2010 profiler I see most of the time is spent garbage collecting in the ProcessLoadTask method of Internals.Core.  Specifically the lines in the finally section:

 

 

GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();

 


I've commented these lines out, and all of a sudden, no more lag.  My buttons are responsive again, and there doesn't appear to be any memory leaking.

Questions:

What is the purpose of GC collecting in this method?  Am I creating a new problem by removing these lines in my application?

 

Additional Info:

My map is being updated every 0.2 seconds as my GPS is updating at a 5hz frequency.

Coordinator
Apr 23, 2010 at 10:51 AM

5hz is unreal, i doubt the coordinate is changed by that time, ...anyway i've added gc long time ago, but i'll test it right now without it!

Apr 23, 2010 at 11:40 PM
Edited Apr 23, 2010 at 11:41 PM

Yea, the 5hz is pretty nice.  QStarz usb/bluetooth key chain gps receiver.  It works really well, and there are dominantly five distinct points, especially when driving at 70mph.  Smooth position updates 5 times a second.

 

Great work on this btw...

Coordinator
Apr 24, 2010 at 12:29 PM

done!