memory: Add the renpy.profile_memory() function.

This is a function that dumps a profile of memory to memory.txt (and
stdout if it's a tty.)