Clear the heap?

vulture2600:
I was thinking that in setup the last line could be something along the lines of "permanently set aside another 1k of ram" after everything else is initialized to create a buffer between static and dynamic memory. I dont know how to use malloc() yet but I would imagine it would be something along the lines of malloc(1000);.

You really need to get a better understanding of stack, heap, static memory, dynamic memory, and the relationships between them.

That being said, your idea may be useful. If, in fact, the problem is a memory leak then it definitely won’t be solve by grabbing and hold more dynamic memory from the heap. But, it could quite possibly make the problem worse. And, that can be helpful in diagnosing it. If it happens more often, you can study it easier.