Reusing Memory in a Cyclone V: Baremetal Project

I need help with my project, I haven’t been able to find any information about writing my program to the SDRAM, but was hoping there might be a way to better utilize the memory available on the on chip RAM for the Cyclone V. Once I seem to reach the limit of the on chip Memory my function appears to be stuck in a hardware loop, so I was wondering if there is a way to avoid this issue but utilizing memory that is no long required by the program.

Any suggestions?