PRB: _vmalloc Fails When Running 386MAX

Last reviewed: July 17, 1997
Article ID: Q88433
7.00 | 1.00 1.50 MS-DOS | WINDOWS kbprg kbprb

The information in this article applies to:

  • Microsoft C/C++ for MS-DOS, version 7.0
  • Microsoft Visual C++ for Windows, versions 1.0 and 1.5

SYMPTOMS

The function 0Fh (Resize Memory Block) of the 386MAX XMS handler seems to always return a value indicating that there is not enough extended memory. This happens when 386MAX version 6.02 or an earlier version of the 386MAX memory manager is installed and the swaparea parameter to _vheapinit() contains only the _VM_XMS value.

CAUSE

The function 0Fh (Resize Memory Block) of the 386MAX XMS handler seems to always return a value indicating that there is not enough extended memory.

RESOLUTION

There are three ways to work around the problem:

  • Bitwise OR (|) the third parameter of the _vheapinit call with either _VM_EMS or _VM_DISK. This will allow _vmalloc to access expanded memory or disk space.
  • Substitute the 386MAX XMS handler with another. For example, run the program under Windows, or remove 386MAX and use HIMEM.SYS.
  • Upgrade to 386MAX version 6.02b or later.

Qualitas has confirmed this to be a problem in 386MAX version 6.02 and in earlier versions. This problem was corrected in 386MAX version 6.02a. To obtain an updated version of 386MAX, use a modem to call the Qualitas BBS at (301) 907-8030. Your 386MAX serial number is required as part of the BBS login procedure. Request the updated version of 386MAX by leaving a message for the BBS sysop.

MORE INFORMATION

Sample Code

/* Compile options needed:    None
*/

#include <stdio.h>
#include <stdlib.h>
#include <vmemory.h>

void main()
{
   _vmhnd_t handle;

   if ( !_vheapinit( 0, _VM_ALLDOS, _VM_XMS) )
   {
      printf( "Could not initialize virtual memory manager.\n" );
      exit( -1 );
   }

   printf( "Requesting 100 bytes of virtual memory.\n" );
   if ( (handle = _vmalloc( 100 )) == _VM_NULL )
      {
      _vheapterm();
      printf("Allocation failed\n");
      exit( -1 );
      }

   _vheapterm();
}


Additional reference words: 7.00 1.00 1.50
KBCategory: kbprg kbprb
KBSubcategory: VirtualMem
Keywords : kb16bitonly VirtualMem kbprb kbprg
Version : 7.00 | 1.00 1.50
Platform : MS-DOS WINDOWS


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.