Are Memory Pools allowed by MISRA-C? - Printable Version +- MISRA Discussion Forums (https://forum.misra.org.uk) +-- Forum: MISRA C (https://forum.misra.org.uk/forumdisplay.php?fid=4) +--- Forum: MISRA C:2012 and MISRA C:2023 guidelines (https://forum.misra.org.uk/forumdisplay.php?fid=21) +---- Forum: 7.4 Code design (https://forum.misra.org.uk/forumdisplay.php?fid=181) +---- Thread: Are Memory Pools allowed by MISRA-C? (/showthread.php?tid=1644) |
Are Memory Pools allowed by MISRA-C? - jpature - 14-03-2023 Hi, Would a memory pool (to handle a variable number of objects) based on a statically allocated chunk of memory be MISRA C compliant ? Or would it be banned because considered as dynamic allocation ? Thanks. RE: Memory pool usage - Francois - 16-03-2023 Hi, I'm also interested in this question. If you create your own sw component, your design can be predictable, controlled and secured. UT proof can also be provided. Also, you will not use heap in this case. It is ok for me, but let's wait for misra-c answer RE: Memory pool usage - jpature - 24-03-2023 (16-03-2023, 07:06 AM)Francois Wrote: Hi, Hi, I agree with it, thus my question Could anyone help answer this question? Thanks RE: Are Memory Pools allowed by MISRA-C? - misra-c - 04-04-2023 As a holding answer... The problems with dynamic memory allocation are numerous, particularly with regards fragmentation and error checking. It also depends on what you mean by "memory pool" - for example, a fixed-sized array of objects, but where the number of used elements depends on the particular build configuration, would probably be OK. Of course, any REQUIRED Rule may be deviated if necessary - but the onus is then on the user to justify the deviation and have appropriate sign off. |