www.delorie.com/djgpp/bugs/show.cgi   search  
Bug 000346

When Created: 10/17/2001 21:21:50
Against DJGPP version: 2.00
By whom: kacanski@eunet.yu
Abstract: DJGPP/CWSDPMI on systems with more than ~480Mb of RAM
Program like this:


        #include <stdio.h>
        #include <malloc.h>

        void *vp[1024];
        int n;

        int main()
        {
          for ( n=0 ; n<1024 ; n++ )
          {
            vp[n]=malloc( 1024 * 1024 );

            printf("%d\n",n);

            if ( vp[n] == NULL ) break;
          }

          printf("%d Megabytes ready for use.\n",n);

          for ( n-- ; n>=0 ; n-- )
          {
            free( vp[n] );
          }

          return 0;
        }

compiled on system with 512Mb of RAM and _with paging option turned off_
stops allocating at ~480Mb and exits with message "No swap space!".

Parameters of CWSDPMI are:

Full name of paging file ("" to disable) ? [*Disabled*] 
Number of page tables to initially allocate (0=auto) ? [0] 
Minimum application memory desired before 640K paging ? [512Kb] 
Paragraphs of DOS memory to reserve when 640K paging ? [3840] 
Paragraphs of memory for extra CWSDPMI internal heap ? [256] 
Maximum size of swap file ? [128Mb] 
Value of run option flags ? [0] 

File system is FAT16 under DOS mode (not DOS prompt) of WIN98
and free space 58Mb.

Workaround added: 10/18/2001 14:49:22
By whom: eliz@is.elta.co.il
Again from Charles Sandmann:

  Fixes are:
   Create UMBs so there is more space for page tables (can be performance
   hit).  Free up DOS memory.  Create a RAM disk of about 1Mb and set
   that drive to be your CWSDPMI swap file (yes, this does sound insane).
   Use newest PMODE in raw mode (no HIMEM.SYS).

Note added: 10/18/2001 14:52:02
By whom: eliz@is.elta.co.il
Says Charles Sandmann:

  This is a known problem with CWSDPMI r5.  It stores its page tables in
  conventional memory.  You need 1Kb per 1Mb of page table space.  If you
  disable paging, there is no way for it to "page" the page tables 
  themselves.

Closed on 10/18/2001 14:56:21: A known limitation of CWSDPMI r5, not a bug
By whom: eliz@is.elta.co.il

Note added: 12/06/2001 14:08:56
By whom: sandmann@clio.rice.edu
A test version (pre r6) of CWSDPMI has been built which contains 4Mb page table support and this version has been tested with up to 2Gb of memory with no swap file.

Note added: 02/11/2003 10:38:37
By whom: sanderstepanov@hotmail.com
I have at the same problem with memory allocation for big arrays, one solution from FAQ to set more memory 

on my computer wiht XP system it is

DPMI memory available: 799359 Kb
DPMI swap space available: 0 Kb

and I have not managed to make it bigger according to FAQ

"15.9 How much stack can I have in DJGPP programs?"

only by declaration of thes arrays as statice this problem was solved but I think it is not a good enouth solution


Sander



  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2010   by DJ Delorie     Updated Jul 2010