Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Can't get GCMessages to work


  • Please log in to reply
3 replies to this topic

#1 Valkyrie-MT

Valkyrie-MT

    Advanced Member

  • Members
  • PipPipPip
  • 315 posts
  • LocationIndiana, USA

Posted 10 July 2012 - 02:52 AM

Am I doing something wrong? Do GC Messages work for anyone with the latest firmware?

For some reason, I can't see any GC Messages when I enable them. Can anyone confirm this by running the following code? Also, I would appreciate it if someone with v4.1 firmware, could try it, because I recall it working fine in 4.1, and it would be nice to have confirmation that the code will generate the messages.

    public class Program
    {
        // This causes a Memory Leak
        static System.Collections.ArrayList list = new System.Collections.ArrayList();

        public static void Main()
        {
            Debug.EnableGCMessages(true);
            int i = 0;

            while (true)
            {
                if (i++ % 100 == 0) 
                    Debug.Print("RAM left = " + Debug.GC(true));
                list.Add("stuff");
            }
        }
    }

Thanks,
-Valkyrie-MT

#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 10 July 2012 - 03:56 AM

Hi Valkyrie-MT, What version of beta firmware are you using? This is with v4.2 RC5 correct? Is this in Visual Studio only, or does it exhibit the behavior when connected via MFDeploy as well? Chris

#3 Valkyrie-MT

Valkyrie-MT

    Advanced Member

  • Members
  • PipPipPip
  • 315 posts
  • LocationIndiana, USA

Posted 10 July 2012 - 04:26 AM

Argh. I think I'm gonna have to debug my memory leak without the meager methods we already had... I am quite convinced now that the EnableGCMessages method is completely broken in 4.2 when deployed to hardware.

I have now tried 4 .NETMF v4.2 devices and none work (including the Netduino Plus (4.2RC3) and Go (Original Release)). Here is the output from MFDeploy for the Go:

Resolving.
Ready.
RAM left = 109932
RAM left = 106920
RAM left = 104880
RAM left = 102420
RAM left = 99324
RAM left = 95280
[...]
RAM left = 25848
RAM left = 24648
Failed allocation for 5397 blocks, 64764 bytes
Failed allocation for 5397 blocks, 64764 bytes
 Uncaught exception 
Done.
Waiting for debug commands...

And.. output from the Emulator works fine:
The thread '<No Name>' (0x2) has exited with code 0 (0x0).
GC: 1msec 279984 bytes used, 3914100 bytes available
Type 0F (STRING              ):     72 bytes
Type 11 (CLASS               ):    396 bytes
Type 12 (VALUETYPE           ):     60 bytes
Type 13 (SZARRAY             ):    492 bytes
  Type 03 (U1                  ):    156 bytes
  Type 04 (CHAR                ):    156 bytes
  Type 07 (I4                  ):     36 bytes
  Type 11 (CLASS               ):    144 bytes
Type 15 (FREEBLOCK           ): 3914100 bytes
Type 16 (CACHEDBLOCK         ):     72 bytes
Type 17 (ASSEMBLY            ):   8592 bytes
Type 18 (WEAKCLASS           ):     48 bytes
Type 1B (DELEGATE_HEAD       ):     72 bytes
Type 1D (OBJECT_TO_EVENT     ):     24 bytes
Type 1E (BINARY_BLOB_HEAD    ): 268080 bytes
Type 1F (THREAD              ):    372 bytes
Type 20 (SUBTHREAD           ):     48 bytes
Type 21 (STACK_FRAME         ):    456 bytes
Type 27 (FINALIZER_HEAD      ):     24 bytes
Type 28 (MEMORY_STREAM_HEAD  ):     36 bytes
Type 29 (MEMORY_STREAM_DATA  ):    396 bytes
Type 31 (IO_PORT             ):     36 bytes
Type 34 (APPDOMAIN_HEAD      ):     72 bytes
Type 36 (APPDOMAIN_ASSEMBLY  ):    636 bytes
GC: performing heap compaction...
RAM left = 3914100
GC: 1msec 283044 bytes used, 3911040 bytes available
Type 0F (STRING              ):   1296 bytes
[...]

-Valkyrie-MT

#4 Lorenzo

Lorenzo

    New Member

  • Members
  • Pip
  • 3 posts

Posted 13 July 2012 - 04:50 PM

The reason for this is that the Netduino platform is compiled for 4.2 with additional flags to limit the debug output in order to decrease the build size.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.