anitil
a day ago
I was wondering how it would do arbitrary-sized kernels without dynamic allocation (my guess was that it would use the input/output buffer as a temporary storage). The answer is that there's a _slight_ asterix to the 'zero-allocation' - the allocation is on the stack [0], but it's small-ish (2kb) and fixed size. So in an embedded context you'd just want to make sure you have headroom for this.
[0] https://github.com/sammycage/plutofilter/blob/main/plutofilt...
Neywiny
15 hours ago
It's interesting. On embedded, heap allocation is usually not done. If it is, it's permanent- free does nothing. Not always the case, you can enable a real alloc/free algorithm, but usually you don't need to free so it doesn't matter. The stack, though... If you take 2KB of stack and you haven't linked that much in, good luck trying to find that "bug" for why everything gets corrupted/crashes. My point here isn't that 2KB is big for embedded, it's actually that I'd prefer it just either statically allocates the memory or uses the heap so I can at least get an "out of memory" error