Finally fixed all memory leaks
After running on the rp2040 again after I thought I fixed the memory leaks it still panicked with an out of memory error. So I went to take another look. The main problem is that all the basic matrix math functions allocated a new matrix for their returns. I had an idea of restructuring them to instead input another matrix to store the result and only return an error code. In practice this didn’t do much since I needed to allocate memory most of the time anyway. This did help a little bit but was probably more trouble than it was worth. Along the way of doing this I noticed a few more memory leaks and fixed them as I went. When I was done I got compile error after compile error but I eventually worked through all of them. But once the compiler errors went away it gave an output that was just slightly off. I narrowed it down to being in the math file and I sent my ai of to find the bug. After a long wait the error was simply that I forgot to uncomment some code when I was debugging the compiler errors. After poking around at a few more memory leaks it now gives the same output without losing any memory at all!
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.