Bird
0
0

What will happen if you call xTaskCreateStatic with a NULL stack buffer when configSUPPORT_STATIC_ALLOCATION is enabled?

medium📝 Predict Output Q5 of 15
FreeRTOS - Memory Management
What will happen if you call xTaskCreateStatic with a NULL stack buffer when configSUPPORT_STATIC_ALLOCATION is enabled?
AThe task will be created using dynamic allocation instead.
BThe function will return NULL indicating failure.
CThe task will be created but with a default stack size.
DThe system will ignore the NULL and allocate memory automatically.
Step-by-Step Solution
Solution:
  1. Step 1: Understand static allocation requirements

    Static allocation requires valid user-provided buffers; NULL stack buffer is invalid.
  2. Step 2: Behavior of xTaskCreateStatic with NULL buffers

    Function returns NULL to indicate failure if buffers are invalid.
  3. Final Answer:

    The function will return NULL indicating failure. -> Option B
  4. Quick Check:

    NULL buffers cause creation failure [OK]
Quick Trick: NULL buffers cause xTaskCreateStatic to fail [OK]
Common Mistakes:
  • Assuming dynamic allocation fallback
  • Thinking default stack is used
  • Believing system auto-allocates memory

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes