Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Are Memory Pools allowed by MISRA-C?
#1
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.
Reply
#2
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 Smile
<t></t>
Reply
#3
(16-03-2023, 07:06 AM)Francois Wrote: 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 Smile

Hi,
I agree with it, thus my question  Smile

Could anyone help answer this question?
Thanks
Reply
#4
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.
Posted by and on behalf of the MISRA C Working Group
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)