PRB: MOVE Application Requires Additional Memory to Load

Last reviewed: July 17, 1997
Article ID: Q99152
5.30 5.31 5.50 5.60 MS-DOS kbtool kbprb

The information in this article applies to:

  • Microsoft LINK for MS-DOS, versions 5.3, 5.31, 5.5, and 5.6

SYMPTOMS

An application that uses the Microsoft Overlaid Virtual Environment may require more memory to run than the same program build with old style (C 6.0) overlays or without any overlay manager. While the size of the executable file may not change significantly, the EXEHDR utility indicates that more memory is required to load the program. (In EXEHDR version 3.0, memory required to load is the last line of information displayed for an MS-DOS program.)

Additionally, the program may not recognize that it contains overlays. Each segment specified in the SEGMENTS statement in the module definition (.DEF) file is empty. In a tracing version of the application, the trace file, MOVE.TRC, is also empty.

CAUSE

This problem may occur when one or more modules of the program is compiled with the /Gy (Enable function-level linking) compiler option and these modules are listed in the SEGMENTS statement in the .DEF file.

RESOLUTION

To avoid the problem, do one of the following:

  • In the .DEF file, specify overlays in the FUNCTIONS statement instead of in the SEGMENTS statement. LINK places function code into the appropriate comdat_seg<n> segment in the overlay (discussed below). Specify the /Gy compiler option switch only for those modules that require function-level linking.
  • Remove the /Gy option switch from the compiler command line.

MORE INFORMATION

The compiler creates a separate segment for each function in modules compiled with the /Gy option switch. The compiler names each segment comdat_seg<n>, where <n> is assigned successive integer values as segments fill up. In addition, the compiler creates an empty segment (0 bytes long) with the name <modulename>_TEXT. The error occurs because the SEGMENTS statement in the DEF file specifies the empty <modulename>_TEXT segments. LINK creates empty overlays and places the functions into the root overlay (overlay 0). Because each overlay is empty, the MOVE.TRC file produced by the tracing version of the overlaid program is also empty.

While the empty segment that the compiler produces with the /Gy option switch prevents erroneous linker messages, it causes the side-effects listed above when the segment is placed into an overlay.

The program may require more memory to load because the MOVE overlay manager requires about 16K. If the code that is expected to be in an overlay is placed into the root overlay, the application requires more memory.

A code sample that demonstrates this problem is fairly easy to create, however, it requires too many files and lines of code to include one in this article. To demonstrate this problem, find an application that use MOVE overlays and the SEGMENTS statement in its .DEF file. Build the application and use EXEHDR to determine its load size. Then add the /Gy option switch to the compiler options for each module placed into an overlay. Rebuild the application and determine its load size.


Additional reference words: 5.30 5.31.009 5.50
KBCategory: kbtool kbprb
KBSubcategory: MoveOverlay
Keywords : kb16bitonly


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 17, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.