From: GAMMELJL AT SLU DOT EDU Date: Wed, 04 Feb 1998 18:15:24 -0600 (CST) Subject: problem with 'new' in plain DOS To: djgpp AT delorie DOT com Message-id: <01IT6WBFNODYC5983X@SLU.EDU> Organization: SAINT LOUIS UNIVERSITY St. Louis, MO MIME-version: 1.0 Precedence: bulk // 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 (but no 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 "",0,512,3840,2048,32760,0 (only the "" and //2048 have 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 by replacing the 2048 by 1024 //(for machines with 64 mb of ram) or 512 (for machines with 32 mb of //ram). // The memory used is // zsize3*zsize2*zsize1*4 bytes //where 4 is the length of an unsigned integer. To convert bytes to //megabytes (mb) divide by 1024^2. // One finds the actual available memory by increasing zsize1 and //zsize2 (I use zsize1=zsize2) until "virtual memory exceeded in 'new' //occurs at run time. // For zsize3=2^n, the actual available memory drops to 1/2 //of the available memory reported by go32-v2. // For zsize3=(2^n) - 1, the actual available memory is close //to the available memory reported by go32-v2. //Note: the cwsdpmi.swp file must be disabled and no reference to //smartdrv.exe may occur in autoexec.bat, otherwise other (as yet //unresolved) problems prevent access to anything close to the available //memory reported by go32-v2. //Since no swap space is provided "virtual memory exceeded in 'new'" //="out of memory". //I do not know whether there is a similar problem with 2-dimensional //arrays or not but I assume there is. #include //notation: a,b means zsize3=a and zsize2=zsize1=b const int zsize3=127; //127,501 ok (121.601 mb) //127,502 out of memory (122.087 mb) const int zsize2=501; //128,356 out of memory (61.882 mb) const int zsize1=501; //128,355 (61.535 mb) ok main() {int i,j; unsigned int * * *m; m= new unsigned int * * [zsize1]; for (i=0;i