5 Replies Latest reply on Jan 16, 2014 10:41 PM by userc_2164
      • 1. Re: How do you check system memory usage?
        ShawnA_01
        There may be a more appropriate or convenient way to do it, but have you tried looking at the .MAP file after the compilation process is done? 

         

         

        For example, after building the snip.email demo within SDK-2.4.0 for the BCM943362WCD4 evaluation board, look at the file:  ~Documents/WICED/Wiced-SDK-2.4.0/WICED-SDK/build/snip_email-BCM943362WCD4/Binary/snip_email-BCM943362WCD4_map.csv

         

         

        Here is a chunk from the very bottom of it:

         

        ---------------------------------- -------- ---------

         

                                                      Static

         

        Module                              Flash      RAM  

         

        ---------------------------------- -------- ---------

         

        App                                489 0

         

        Bootloader                         134 0

         

        dhcp_server                        2271 132

         

        dns                                2032 44

         

        Host MCU-family library            14284 2626

         

        Interrupt Vectors                  660 0

         

        libc                               51370 2632

         

        Networking                         4431 35356

         

        NetX                               51770 644

         

        Platform                           1014 0

         

        RAM Initialisation                 2480 0

         

        smtp                               3536 0

         

        sntp                               706 56

         

        Startup Stack & Link Script fill   465 852

         

        Supplicant - BESL                  61436 436

         

        ThreadX                            8752 392

         

        Wi-Fi Firmware                     203268 0

         

        Wiced                              6181 810

         

        WWD                                15489 1068

         

        ---------------------------------- -------- ---------

         

        TOTAL (bytes)                      430768 45048

         

        ---------------------------------- -------- ---------
        • 2. Re: How do you check system memory usage?
          There may be a more appropriate or convenient way to do it, but have you tried looking at the .MAP file after the compilation process is done?  

           

           

          For example, after building the snip.email demo within SDK-2.4.0 for the BCM943362WCD4 evaluation board, look at the file:  ~Documents/WICED/Wiced-SDK-2.4.0/WICED-SDK/build/snip_email-BCM943362WCD4/Binary/snip_email-BCM943362WCD4_map.csv

           

           

          Here is a chunk from the very bottom of it:

           

          ---------------------------------- -------- ---------

           

                                                        Static

           

          Module                              Flash      RAM  

           

          ---------------------------------- -------- ---------

           

          App                                489 0

           

          Bootloader                         134 0

           

          dhcp_server                        2271 132

           

          dns                                2032 44

           

          Host MCU-family library            14284 2626

           

          Interrupt Vectors                  660 0

           

          libc                               51370 2632

           

          Networking                         4431 35356

           

          NetX                               51770 644

           

          Platform                           1014 0

           

          RAM Initialisation                 2480 0

           

          smtp                               3536 0

           

          sntp                               706 56

           

          Startup Stack & Link Script fill   465 852

           

          Supplicant - BESL                  61436 436

           

          ThreadX                            8752 392

           

          Wi-Fi Firmware                     203268 0

           

          Wiced                              6181 810

           

          WWD                                15489 1068

           

          ---------------------------------- -------- ---------

           

          TOTAL (bytes)                      430768 45048

           

          ---------------------------------- -------- ---------

           

           

          Hi Santol,

           

           

          I was referring to real time system emory usage debug such as maximum allocated memory and current memory used from heap.
          • 3. Re: How do you check system memory usage?
            MuOr_1658816
            I am wondering the same. Any answer to this?

             

             

            Hi Santol,

             

             

            I was referring to real time system emory usage debug such as maximum allocated memory and current memory used from heap.
            • 4. Re: How do you check system memory usage?

              Does mallinfo() work?

              <WICED-SDK>/Apps/test/console/mallinfo/mallinfo.c

              • 5. Re: How do you check system memory usage?

                Static memory usage can be seen in the build output. 

                 

                To get information on dynamic memory usage, you can use mallinfo() as follows:

                        volatile struct mallinfo mi = mallinfo();

                 

                Then look at the structure elements of variable "mi"

                struct mallinfo {

                  int arena;    /* total space allocated from system */

                  int ordblks;  /* number of non-inuse chunks */

                  int smblks;   /* unused -- always zero */

                  int hblks;    /* number of mmapped regions */

                  int hblkhd;   /* total space in mmapped regions */

                  int usmblks;  /* unused -- always zero */

                  int fsmblks;  /* unused -- always zero */

                  int uordblks; /* total allocated space */

                  int fordblks; /* total non-inuse space */

                  int keepcost; /* top-most, releasable (via malloc_trim) space */

                };

                 

                The "arena" that malloc & mallinfo use may not have expanded to fill your memory. To get the total size of the heap, you can look at the symbols _heap and _eheap.

                 

                FreeRTOS & LwIP use dynamic memory for most of their variables. ThreadX / NetX uses mostly static memory.

                 

                Regards,

                 

                Evan Hunter