0
0
FreeRTOSprogramming~20 mins

Memory usage monitoring in FreeRTOS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
FreeRTOS Memory Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Interpreting FreeRTOS heap_4 memory usage output
Given the FreeRTOS heap_4 memory scheme, what does the following output from xPortGetFreeHeapSize() indicate?
FreeRTOS
size_t freeHeap = xPortGetFreeHeapSize();
printf("Free heap size: %u bytes\n", (unsigned int)freeHeap);
AIt shows the total free heap memory available for allocation at runtime.
BIt shows the total heap memory used by all tasks combined.
CIt shows the maximum heap size configured in FreeRTOSConfig.h.
DIt shows the stack size of the currently running task.
Attempts:
2 left
💡 Hint
Think about what 'free heap size' means in memory management.
🧠 Conceptual
intermediate
2:00remaining
Understanding stack overflow detection in FreeRTOS
Which FreeRTOS feature helps detect stack overflow in tasks during runtime?
AEnabling configUSE_IDLE_HOOK to check stack limits.
BUsing xPortGetFreeHeapSize() to monitor stack usage.
CconfigCHECK_FOR_STACK_OVERFLOW set to 1 or 2 enables stack overflow checking.
DSetting configMAX_PRIORITIES to a higher value.
Attempts:
2 left
💡 Hint
Look for configuration options related to stack overflow.
Troubleshoot
advanced
2:00remaining
Diagnosing unexpected heap exhaustion in FreeRTOS
A FreeRTOS system using heap_4 suddenly runs out of heap memory causing task creation failures. Which of the following is the most likely cause?
AconfigUSE_PREEMPTION set to 0.
BMemory fragmentation due to many small allocations and frees.
CUsing xTaskGetTickCount() incorrectly.
DStack overflow in the idle task.
Attempts:
2 left
💡 Hint
Think about how heap_4 manages memory blocks.
🔀 Workflow
advanced
2:30remaining
Steps to monitor FreeRTOS task stack usage at runtime
What is the correct sequence of steps to monitor the stack usage of a FreeRTOS task during runtime?
A4,3,2,1
B2,1,3,4
C1,3,2,4
D1,2,3,4
Attempts:
2 left
💡 Hint
Think about how to get data, interpret it, then act on it.
Best Practice
expert
3:00remaining
Best practice for minimizing heap fragmentation in FreeRTOS
Which approach best minimizes heap fragmentation when using FreeRTOS heap_4 memory scheme in a long-running embedded system?
AUse fixed-size memory pools for dynamic allocations instead of malloc/free.
BIncrease configTOTAL_HEAP_SIZE to maximum possible value.
CDisable stack overflow checking to reduce overhead.
DUse heap_1 scheme instead of heap_4.
Attempts:
2 left
💡 Hint
Think about avoiding fragmentation by controlling allocation sizes.