Manage private heaps… here is a solution to the problem.
Manage private heaps
I’ve seen in some projects (basically many C/C++ embedded applications) that they manage dynamic allocation as follows
- Acquire a large amount of memory during initialization as needed. The zone is designated as the heap for that application.
- All dynamic allocations across different routines are made in this memory through wrappers designed for allocation and maintenance (tracing and debugging allocations).
Question:
Q1: The advantages of private heap management in the above design.
Question 2: Are there any built-in functions in C and Linux APIs that provide interfaces for dynamic allocation in previously allocated blocks? I rummaged through it but couldn’t get my hands on it
Q3: If the option mentioned in Q2 is not available. Any ideas on how to achieve the goals mentioned in Q2.