Returns the amount of free RAM in number of bytes by measuring the distance between he heap and the stack. Results are not really consistent as the measure is taken in a single place in the program, and it doesn't take in account background operations (interrupts). When your Gamebuino acts randomly, you're probably out of RAM. More info here: Memory optimization.
int: the amount of free RAM in number of bytes