3.5.20 Why Do I Get Out-of-memory Errors When I Select a Debugger?
If you use a hardware tool debugger, such as the MPLAB REAL ICE or ICD 3, these might require some of the memory resources available on your PIC device for the on-board debug executive. When you select a debugger within an MPLAB X IDE project and perform a debug build, the memory required for debugging is removed from that available. In some situations, for programs that use a large amount of memory, this might be enough to trigger a 'can't find space' memory error.