Use for Memory allocation?

So I saw this thread: https://vexforum.com/t/how-to-use-malloc-or-free-in-robotc/36036/1

I know that ROBOTC does not support malloc, but jpearman posted a library for one. I’m curious as to how that would be useful.

The BNS library wanted to have a dynamic sized array for some of their items. So they implemented their own malloc looking for contiguous memory block sizes available to store their stuff. If memory is available, they claim it for you. They have also implemented some defragmenting routines too to clean up after themselves.

It’s pretty clever.

You can look at their BNS malloc routine in here:

The malloc is used by their matrix functions for dynamic sizes which is used by their matrix math functions which is used by their filters. This way you don’t make a fixed number of items in your filter, the code will manage just the size you need. There will be an upper limit though. Not sure what that is.