KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q40785: Available Memory in C with More Than 20 Files and PC-DOS 3.30

Article: Q40785
Product(s): See article
Version(s): 5.10
Operating System(s): MS-DOS
Keyword(s): ENDUSER | | mspl13_c
Last Modified: 16-MAY-1989

Question:

Following the directions in the C 5.10 README.DOC file, I have
modified the CRT0DAT.ASM file to increase the number of file handles
from 20 to 30. I have a simple program (below) that checks the amount
of available memory. When I link it with the modified CRT0DAT and
execute the program, the amount of available memory is significantly
less (approximately 64K) if I am running PC-DOS 3.30 than it is if I
am running MS-DOS 3.30.

Note: If I do not link in the CRT0DAT, then the difference in the
available memory between MS-DOS 3.30 and PC-DOS 3.30 is negligible.

All memory models will produce results similar to those described
above.

How can I eliminate this inconsistency between the two versions of
DOS?

Response:

The only workarounds are to not link with a modified CRT0DAT.ASM, or
to use MS-DOS instead of PC-DOS.

Microsoft is researching this problem and will post more information
as it becomes available.

The following program, compiled with "cl /W3 /c", demonstrates the
problem:

#include <stdio.h>
#include <dos.h>

void main(void)
{
   unsigned size;
   unsigned segment;

   printf("Checking memory:\n");
   size = 0xffff;
   if (_dos_allocmem (size, &segment))
      printf("Available paragraphs: %u\n",segment);
   else
      printf("Memory allocated.\n");
}

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.

Copyright Microsoft Corporation 1986-2002.