Machine-translated by Google. Questions are authored in English.
Top

Discussion

Avoiding malloc in an embedded program is usual because

  • A.it cannot be called from a task under a kernel
  • B.dynamically allocated memory cannot be freed
  • C.allocation can fail or fragment unpredictably at run time
  • D.the C library does not provide it on embedded targets

Answer: C

A failure or a fragmented heap appears after weeks in service rather than in test, and the worst-case timing of an allocation is hard to bound. Static allocation, or a pool of fixed-size blocks, gives both determinism and a compile-time guarantee that the memory exists.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.