Re:Tinyalloc: replacement for malloc/free in unmanaged, line...
by Const-me on Sunday January 06, 2019 @05:17PM
(#18841097)
In my experience, best way to implement a network protocol on a small embedded chip is fixed length statically allocated circular buffer, not malloc.
[ Parent
| on HN ]
Re:Tinyalloc: replacement for malloc/free in unmanaged, line...
by okl on Sunday January 06, 2019 @05:58PM
(#18841291)
That would be like a "first-fit-or-die" malloc, wouldn't it? Which mechanism to choose always depends on your (de-)allocation profile and available memory. If you can free out-of-order, the circular buffer will fragment quickly.
Re:Tinyalloc: replacement for malloc/free in unmanaged, line...
by Const-me on Sunday January 06, 2019 @07:31PM
(#18841767)
> If you can free out-of-order, the circular buffer will fragment quickly.
Right, just when coding a network protocol for embedded, often you can free in the same order, i.e. it’s often a good idea to limit parallelism to a small number of FIFO streams (ideally a single one).
That’s only for small chips. When they aren’t small e.g. you have a quad-core ARM with a gig of RAM you usually have OS anyway and the programming is totally different, much higher level and you guaranteed to have a fast malloc and lots more.