GC takes over 2 seconds to complete on Cobra II (4.3.4) when VS debugger is not attached. When it is attached, it takes few milliseconds. Why? Two seconds is really a lot of time during which board is not responsive.
Sample code:
Dim led As Boolean
Dim c As Integer
While True
led = Not led
Mainboard.SetDebugLED(led)
Thread.Sleep(100)
c += 1
If c = 30 Then
c = 0
Debug.GC(True)
End If
End While
Take a look how LED stops flashing for 2+ seconds while VS debugger is not attached.
@ iamin - Looks like it is that bug on CodePlex. I was able to reproduce it, but when I called Debug.EnableGCMessages(false) before the loop it went away.
Ok so the bug is in debug.print in general where things run slow when nothing is attached. I wonder if we can somehow cheat and make this work on the driver level.
Yeah, [em]Debug.EnableGCMessages(false)[/em] helps to hide this issue.
Here is another example. Blinking rate is slowed down by a factor of ~2 when debugger is not attached, but board is powered from USB cable (fully plugged).
Dim led As Boolean
While True
led = Not led
Mainboard.SetDebugLED(led)
Thread.Sleep(100)
Debug.Print("Some random message here to test how it will work...")
End While