Hello,
is there any sort of queue in ChibiOS where each element can have a different size?
thanks in advance.
best regards
dynamic sized queue
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: dynamic sized queue
Hi,
Not directly, you could use mailboxes and an heap allocator in that scenario.
You may look at how Objects Queues are implemented in OSLIB and replace the pool allocator with the heap allocator. The inherent problems with this approach are:
1) You cannot use it from ISRs, heap allocator does not allow that.
2) You may hit an heap fragmentation problem, this is inherent with dynamic allocation.
Giovanni
Not directly, you could use mailboxes and an heap allocator in that scenario.
You may look at how Objects Queues are implemented in OSLIB and replace the pool allocator with the heap allocator. The inherent problems with this approach are:
1) You cannot use it from ISRs, heap allocator does not allow that.
2) You may hit an heap fragmentation problem, this is inherent with dynamic allocation.
Giovanni
- alex31
- Posts: 379
- Joined: Fri May 25, 2012 10:23 am
- Location: toulouse, france
- Has thanked: 38 times
- Been thanked: 62 times
- Contact:
Re: dynamic sized queue
Hello,
I also had this need many times, I use Giovanni solution : mailboxe and heap allocator.
When I need constant time allocation and very low fragmentation, I use TLSF as heap allocator :
tlsf heap allocator github
Alexandre
I also had this need many times, I use Giovanni solution : mailboxe and heap allocator.
When I need constant time allocation and very low fragmentation, I use TLSF as heap allocator :
tlsf heap allocator github
Alexandre
Who is online
Users browsing this forum: No registered users and 49 guests