Run the e-size program on the Epiphany ELF file. It tells you the static memory consumption of your program.
The dynamic memory consumption (stack and heap) is not easily found out.
Since your code should not use the heap at all, just add some margin for the stack to those numbers.
You can use the upper 16 MB of shared memory for your communication needs.
The lower 16 MB are used for miscellanous stuff (see the linker file for details).