- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
If i would like to debug the entire system memory usage, how would i do that? I was not able to find related API or defines that enable me to get or print logs that shows current system memory status.
Thanks in Advance.
Solved! Go to Solution.
- Labels:
-
Memory
- Tags:
- advance
- check
- current
- debug
- defines
- enable
- entire
- find
- logs
- memory
- memory usage
- related
- shows
- status
- system
- usage
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Does mallinfo() work?
<WICED-SDK>/Apps/test/console/mallinfo/mallinfo.c
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.csvHere is a chunk from the very bottom of it:---------------------------------- -------- --------- Static Module Flash RAM ---------------------------------- -------- ---------App 489 0Bootloader 134 0dhcp_server 2271 132dns 2032 44Host MCU-family library 14284 2626Interrupt Vectors 660 0libc 51370 2632Networking 4431 35356NetX 51770 644Platform 1014 0RAM Initialisation 2480 0smtp 3536 0sntp 706 56Startup Stack & Link Script fill 465 852Supplicant - BESL 61436 436ThreadX 8752 392Wi-Fi Firmware 203268 0Wiced 6181 810WWD 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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Santol,I was referring to real time system emory usage debug such as maximum allocated memory and current memory used from heap.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Does mallinfo() work?
<WICED-SDK>/Apps/test/console/mallinfo/mallinfo.c
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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