A brutal solution may be to initialize the heap to 0, and then just count any non-zero bytes. When you free memory, however, you'd have to also zero it.
You could measure the stack via the stack pointer (ESP in Intel x86 assembler). Although, I don't know if PICs use anything like ESP.
For ROM, solutions have been posted above. Searching for a tag seems like the best idea.
All this is possible in C, but you will need to use inline assembler. Again, I don't even know if that's possible with whatever compiler you're using.