Is there any limit to the size of objects I can define?
Obviously, the amount of memory implemented by the device is the ultimate limit, but due to the way things are necessarily linked into memory and fragmentation of memory, there may be additional restrictions in the size of objects. It may be possible you receive memory errors even with some memory remaining.
Limitations with the 8-bit devices are:
- There is no actual function size limit for MPLAB® XC8 compilers. But for the PIC10/12/16 devices, (baseline and mid-range parts) functions that do cross pages may be slightly less efficient due to longer call and go to code sequences that must be employed. This is not the case for PIC18 and enhanced mid-range devices.
- In terms of data objects, all objects must be able to fit into the general purpose memory in one data bank. With mid-range and baseline devices, some of each data bank is taken up by special function registers. Again, the exception is for PIC18 and enhanced mid-range PIC® devices which can define objects larger than one bank in size.
The linker never deals with the placement of variables; it only deals with the placement of blocks of variables. Like everything else, variables are placed into a psect (section) which is linked as a whole. A psect cannot be split, which can mean that it may not be able to be located when there are only small gaps remaining in memory.
Also, see the FAQ "Can’t find space error".