dynamic sized queue

Discussions and support about ChibiOS/RT, the free embedded RTOS.
cpucooler
Posts: 4
Joined: Mon Jul 06, 2020 10:44 am

dynamic sized queue

Postby cpucooler » Tue May 11, 2021 2:34 pm

Hello,
is there any sort of queue in ChibiOS where each element can have a different size?
thanks in advance.

best regards

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: dynamic sized queue

Postby Giovanni » Tue May 11, 2021 2:44 pm

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

User avatar
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

Postby alex31 » Tue May 11, 2021 9:05 pm

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


Return to “ChibiOS/RT”

Who is online

Users browsing this forum: No registered users and 8 guests