- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is just a general question about messaging and queues.
How are you guys allocating Q messages? For instance, each message I send is a pointer to a struct. My struct contains an ENUM value and a pointer. In all my message structure is 8 bytes. When I post to a Q, I send a pointer to one of these message structures. Should I be using the memory management functions every time and doing dynamic memory allocation of one of these message structures? I don't really know how else to do it without allocating a bunch of global msg structs at compile time. Any insight to this would be appreciated.Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I prefer to use ring buffers. i do a calculation what ring buffer size is needed and add some safety margin.
Personally i am not a friend of dynamic memory allocation and freeing in embedded systems. Unless you have a serious memory shortage i see nothing wrong with allocating big chunks of memory at compile time. At least so see then very early were potential bottlenecks lie. Its also easier to test.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page