delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/30/13:49:43

From: GAMMELJL AT SLU DOT EDU
Date: Fri, 30 Jan 1998 12:47:09 -0600 (CST)
Subject: problem with 'new' in plain DOS mode
To: djgpp AT delorie DOT com
Message-id: <01ISZLDQJPBMC57PZ9@SLU.EDU>
Organization: SAINT LOUIS UNIVERSITY St. Louis, MO
MIME-version: 1.0

//    There is a problem with the 'new' operator when runnning in plain DOS
//mode (press F8 after "starting windows95 appears and select option 6)
//even when plenty of memory and swap space has been made available
//by adding NOVCPI after NOEMS in c:\config.sys and answering the querys
//in c:\djgpp\bin\cwsparam with cwsdpmi,0,512,3840,2048,32760,0 (only the
//2048 has been changed from the answers in the original djgpp package).
//   While my machine has 128 mb of RAM it should be possible to reproduce
//this problem on machines with less RAM because it occurs when fewer
//than 16 mb are set aside for the array m.

#include <iostream.h>

const int zsize3=64;
const int zsize2=454;
const int zsize1=100;

           //gnu C/C++ compiler fails in plain DOS for zsize1=71

           //Error message=virtual memory exceeded in 'new'

           //go32-v2 reports
           //        DPMI available 123519 Kb
           //        DPMI swap space available 130389 Kb

           //The memory required is only about 64 x 454 x zsize1 x 4
           //        =~8000 Kb for zsize1=71

           //Watcom C/C++ compiler good for zsize1=100  (12 Mb required)
           //gnu C/C++ compiler good in DOS box for zsize1=100

main()
{int i,j;

     unsigned int * * *m;
     m= new unsigned int * * [zsize1];      
     for (i=0;i<zsize1;i++)                 
       {m[i] = new unsigned int * [zsize2];  
        for (j=0;j<zsize2;j++)
          {m[i][j] = new unsigned int [zsize3];}
       }

  cout<<"done"<<'\n';
  return 0;
}

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019