RTOS & Real-Time Concepts · Interview question

What are the FreeRTOS heap schemes and when would you choose each?

A strong answer

FreeRTOS ships several heap implementations and you link exactly one (or use fully static allocation). heap_1 only allocates and never frees, it's the simplest and safest, with no fragmentation possible, ideal for systems that create all their tasks/queues at startup and never delete them, which is common in safety-critical designs. heap_2 supports freeing but doesn't coalesce adjacent free blocks, so it fragments over time; it's legacy and superseded by heap_4. heap_4 is the common general-purpose choice: it supports free and coalesces adjacent free blocks to combat fragmentation, suitable for systems that create and delete objects at runtime. heap_5 is like heap_4 but spans multiple, possibly non-contiguous memory regions, used when your RAM is split across separate banks or you want to place the heap in specific regions. The decision: heap_1 or fully static for safety-critical / no-fragmentation requirements (allocate-at-init, never free); heap_4 for general dynamic use; heap_5 when memory is non-contiguous. The corollary is that if vTaskStartScheduler() appears to "return," you almost certainly ran out of heap while creating tasks, you increase configTOTAL_HEAP_SIZE, switch to static creation, or pick a more appropriate scheme. Choosing deliberately matters because the heap behavior directly affects fragmentation, determinism, and memory safety.

What a weak answer sounds like

You know the answer. Do you know what gets you dinged?

Pro breaks down the answer most candidates actually give to this question — and the specific reason an interviewer marks it down. It’s the difference between sounding correct and sounding senior, on all 472 questions.

From the lesson

FreeRTOS: A Practical Tour

Tying it together: the FreeRTOS API mapped to every concept (tasks, queues, mutexes, timers, notifications), a worked ISR-to-task app, key FreeRTOSConfig.h knobs, heap schemes, and debugging.

More FreeRTOS: A Practical Tour questions

Browse all 472 interview questions
What are the FreeRTOS heap schemes and when would you choose each? | EmbeddedPrep.io