Posts: 2
Threads: 1
Joined: Mar 2023
Reputation:
0
14-03-2023, 02:23 PM
(This post was last modified: 24-03-2023, 09:08 AM by jpature.)
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.
Posts: 632
Threads: 18
Joined: Jan 2006
Reputation:
1
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