GC takes over 2s to complete

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
	c += 1
	If c = 30 Then
		c = 0
	End If
End While

Take a look how LED stops flashing for 2+ seconds while VS debugger is not attached.

I believe it’s not GC, but the good old USB debug output bug.

1 Like

debug using MFDeploy instead of VS.

I did a quick test. If I half-plug USB cable (so that only power pins are connected), I get no hangs. What a nasty bug… Is anyone working on it?

I do not see how this could be possible! But we will test on our end to double check.

It’s more than possible. There’s lots of chat about this bug in the forum, it’s an ancient one.

It’s even on Codeplex:


I am talking about half plug USB cable, very much not possible!

Oh, ok. My bad.

@ Gus - why not? The power tracks are longer than the data tracks.

Yes :slight_smile:

That is a quick and dirty way to test what will happen if only 5V power line is connected while data lines are not connected.

@ 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.

… And half plugging the usb cable week not solve this :slight_smile:

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
	Debug.Print("Some random message here to test how it will work...")
End While

Would be nice.

Just to make it super-clear:

  1. No Debug.Print() -> no problems;
  2. Debug.Prints -> USB attached -> Debugger (or Fez Config) attached -> no problems;
  3. Debug.Prints -> USB attached -> Debugger (or Fez Config) not attached -> problems!!!;
  4. Debug.Prints -> USB not attached -> no problems;
1 Like