Panda II Debug.Print question


I have a small program that receives data on com1 using the receive interrupt

The program calls Debug.print(“test”) twice a second.

When I send data to the port (19200 baud packets of 64 bytes about 20 times a second) I get these
additional prints in the output window. Can you tell me where I can find documentation that explains more about what the things that show up in the output window mean?


using System;
using System.Threading;
using System.IO.Ports;
using System.Text;

using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;

using GHIElectronics.NETMF.FEZ;

namespace serialTest3
    public class myTest
        public static void Main()
            SerialPort UART = new SerialPort("COM1", 19200);
            int read_count = 0;
            byte[] rx_byte = new byte[1];

            UART.DataReceived += new SerialDataReceivedEventHandler(UART_DataReceived);
            while (true)


        static void UART_DataReceived(Object sender, SerialDataReceivedEventArgs e)
            SerialPort UART = (SerialPort)sender;

            //retrieve number of bytes in the buffer 
            int bytes = UART.BytesToRead;
            //create a byte array to hold the awaiting data 
            byte[] comBuffer = new byte[bytes];
            //read the data and store it 
            UART.Read(comBuffer, 0, bytes);
            //UART.Write(comBuffer, 0, comBuffer.Length);


GC: 2msec 11652 bytes used, 52728 bytes available
Type 0F (STRING ): 72 bytes
Type 11 (CLASS ): 684 bytes
Type 12 (VALUETYPE ): 36 bytes
Type 13 (SZARRAY ): 132 bytes
Type 15 (FREEBLOCK ): 52728 bytes
Type 17 (ASSEMBLY ): 7932 bytes
Type 18 (WEAKCLASS ): 48 bytes
Type 1B (DELEGATE_HEAD ): 144 bytes
Type 1D (OBJECT_TO_EVENT ): 72 bytes
Type 1E (BINARY_BLOB_HEAD ): 252 bytes
Type 1F (THREAD ): 768 bytes
Type 20 (SUBTHREAD ): 96 bytes
Type 21 (STACK_FRAME ): 612 bytes
Type 27 (FINALIZER_HEAD ): 96 bytes
Type 31 (IO_PORT ): 108 bytes
Type 34 (APPDOMAIN_HEAD ): 72 bytes
Type 36 (APPDOMAIN_ASSEMBLY ): 528 bytes

GC output. It is very important but you can disable it

debug.gc.disablemessage…or something like that

Hello Gus,

so am I correct in assuming that when you are debugging, the controller outputs these status dumps whenever the garbage collector cleans up some unused structures from memory?

Is that why I see these statements more often if I run code that creates local variables inside a function?


Correct. Ease search the wiki for “thinking small”

Yes, they’re output from the Garbage Collector, and yes you’ll see more of them if the GC runs more often - that could be because you are destroying objects more, or you have lots of strings etc. On a very simple program you wouldn’t expect GC to run very often, on a highly complex one it’s possible that GC will run a lot more, but it’s also possible to manage that down so you don’t have that as an impact.

GC output is “normal” and as Gus says can give you insights into how your app is running (memory not being released or GC running often to clean up after you, for instance). You can disable it if you want, you can leave the messages. If you use debug.print as a tool to help debug then you probably don’t care that you get this interspersed with other status messages. What you choose to do is really up to you !

Thanks Gus, I will have to remember to think small. Very good advice in the embedded world.