MCU: TM4C1294NCPDT
TI-RTOS: v2.01.00.03
NDK: v2.23.01.01
CCS: v6.0.1.0040
Hi,
Following the HTTP Example (processors.wiki.ti.com/.../TI-RTOS_HTTP_Example) for implementing Embedded Web Server on Tiva C MCU, I have noticed that when I keep on pressing the F5 (Refresh) button on my computer keyboard at a very fast pace (or press & hold the button), the RTOS running on Tiva C MCU crashes due to low heap memory. On the particular .cgi file hook function I have used the following at the beginning of the function to print out the Heap memory details.
Memory_Stats stats;
Memory_getStats(NULL, &stats);
System_printf("%d, %d, %d\n", stats.totalSize, stats.totalFreeSize, stats.largestFreeSize);
This resulted into the following being printed on the Console of Code Composer Studio in Debug Mode:
50000, 28808, 19584
50000, 35128, 25744
50000, 28808, 21632
50000, 24696, 21632
50000, 26664, 25760
50000, 24488, 19600
50000, 22312, 17552
50000, 20136, 15504
50000, 17960, 13456
50000, 15784, 11408
50000, 13608, 9360
50000, 11432, 7224
50000, 9256, 5088
50000, 7080, 4112
50000, 4904, 4112
{module#53}: line 307: out of memory: handle=0x20038078, size=2048
xdc.runtime.Error.raise: terminating execution
This shows that the heap memory ran down to a very low memory resulting into eventual NDK or RTOS crash. Now, I can not ask the end user NOT to refresh the webpage at this fast pace. So, is there a way to handle this? If the webpage request is NOT handled by the NDK (just before the crash or under a low heap memory state), it is still Okay, but the Tiva C MCU must not crash!!
Thanks
Regards
Soumyajit Das