µTasker Forum
µTasker Forum => µTasker general => Topic started by: akorud on May 30, 2008, 11:47:04 AM
-
Hi,
is there any practical difference (especially in our kind of software) between allocating data structures dynamically in heap and declaring them at compile-time?
regards,
Andriy Korud
-
Hi Andriy
There is usually not a big difference - of course accessing then is either via a pointer (when on heap) or as struct when fixed (although one could in addition have a pointer to the fixed the struct).
Where heap based structs become useful is when the system is configurable. Eg. There are several task table configurations and a board configures itself to suit one of them (and can change the next time it configures itself). In this case, only the structs used by the specific configuration need to be constructed in heap rather than having to have all fixed for every possible configuration (even when not used) - this results in better memory utilisation.
Regards
Mark