If you compile using something like Microchips Assembler (which you would do for things like the 18F series), then looking at the end of the generated .LST file you will find a couple of lines like...

Program Memory Bytes Used: 15998
Program Memory Bytes Free: 386