| Problem | Impact | ASIL Requirement |
|---|---|---|
| Fragmentation | Allocation failure at unpredictable time → system crash | ASIL-A and above: deterministic timing required |
| Non-determinism | malloc takes variable time depending on heap state | ISO 26262 requires bounded execution time |
| Memory leaks | No RTOS-level garbage collection; leaks cause eventual failure | Not detectable without sanitizer tools |
| Heap corruption | Buffer overrun can corrupt adjacent allocations | Silent data corruption, wrong actuator output |
💡 Alternative: Static Memory Pool
Replace dynamic allocation with a static pool: a fixed array of objects pre-allocated at compile time. Pool_Alloc() returns a pointer to the next free slot; Pool_Free() marks it free. All memory is in BSS (zero-initialised), deterministic, and sized correctly at build time. AUTOSAR BSW uses this pattern throughout (e.g., CanIf PDU buffers are statically configured in ARXML).