Bird
0
0

You want to create a FreeRTOS task that must never fail due to memory fragmentation or heap exhaustion. Which approach is best and why?

hard📝 Application Q15 of 15
FreeRTOS - Memory Management
You want to create a FreeRTOS task that must never fail due to memory fragmentation or heap exhaustion. Which approach is best and why?
AUse static allocation with user-provided buffers for predictability.
BMix static and dynamic allocation to balance memory usage.
CUse dynamic allocation with a large heap to avoid failures.
DDisable task deletion to prevent memory leaks.
Step-by-Step Solution
Solution:
  1. Step 1: Understand memory failure causes in FreeRTOS

    Dynamic allocation can fail due to heap fragmentation or exhaustion, causing task creation failure.
  2. Step 2: Evaluate static allocation benefits

    Static allocation uses fixed buffers provided by the user, ensuring memory is reserved and predictable, preventing allocation failures.
  3. Step 3: Compare other options

    Using dynamic allocation with a large heap still risks fragmentation failures; mixing allocation methods adds unnecessary complexity; disabling task deletion is unrelated to allocation issues.
  4. Final Answer:

    Use static allocation with user-provided buffers for predictability. -> Option A
  5. Quick Check:

    Static allocation prevents heap failures [OK]
Quick Trick: Static allocation avoids heap fragmentation failures [OK]
Common Mistakes:
  • Assuming large heap solves all allocation issues
  • Mixing allocation methods without clear reason
  • Confusing task deletion with allocation safety

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes