Microsoft KB Archive/11349

Working with Program Size

PSS ID Number: Q11349 Article last modified on 03- 1-1988

3.30 XENIX

Question: With an IBM AT (1.5 megabyte), when we run a large program written in FORTRAN, the system answered “Killed” without any execution of the program. The size is 614K; 485K text plus 62K data plus 66K bss, with a symbol map of 27K. What could be the problem?

Response: If, for any reason, you create a program executable file that is too large, XENIX will not know initially that there is a problem, and it will begin to execute the program. It is while XENIX is setting up the program for execution that it realizes there is a size problem. At that point XENIX “kills” the program. When XENIX kills a program it not only stops execution it also does some necessary clean up work. Thus, if you get a “killed” message from the system, your program is probably too large to be run by XENIX. Programs may be killed for other reasons, but size problems are the most likely reason. When you receive this message, review all components of your program to see what is taking up too much space. We recommend that you use the XENIX “hdr” command, rather than the “size” command, to determine what is using up the space. The “hdr” command (use it with the -S switch) will give you additional information that will enable you to pinpoint more exactly where you can slim down your program. No segment can be larger than 64K. The total size of your code can be larger than 64K, but that is because the compiler breaks up your program code into separate segments. Your data segment can not be larger than 64K. Even if your data segment is smaller than 64K, you may still have a data segment that causes XENIX to kill your program. Allow extra room in your first data segment for the stack, which will be added on during execution. You should allow at least 4K for the stack, which means that in reality you are limited to, at most, 60K. One possible workaround is to look at your program and data structure (using the “hdr” command) and either cut out unnecessary space or put it into common blocks (as described in the FORTRAN XENIX manual in Section 3.2.3 of the user’s guide, “Working with Limits on Compile Time Memory”).