The most likely cause is that your source file is too big. This is either because you only have one source file, and it contains all the code, or you have many source files, but they're all
#include'ed in a since file which is then compiled.
The solution is to split the code up into separately compiled modules.
The next most likely cause is that you're using some ancient 16-bit fossil compiler, and you're using the wrong
memory model. If your code (or data) exceeds 64K, and you've chosen the wrong memory model, then the program will no longer fit in memory.
The solution is to use the correct memory model for your project (see your compiler manual pages for details of how to do that).
A better solution is to use a modern 32-bit compiler and join the rest of the real world.