delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/05/23/11:23:54

Message-ID: <35A52C81CAE0D51198E20090276A816F1C4DC9@sail.excelsior>
From: "Yeryomin, Alex" <ayeryomin AT excelsior-usa DOT com>
To: "'djgpp AT delorie DOT com'" <djgpp AT delorie DOT com>
Subject: Memory limit in 64 Mb under DOS?
Date: Thu, 23 May 2002 21:53:40 +0700
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.0.1460.8)
Reply-To: djgpp AT delorie DOT com

Hi! Is there anybody? 

We use DJGPP-compiled program under "pure" DOS on compure equipped more than
64 Mb of memory, as usual 128 and ever more till 512 Mb. The program works
under stress memory-usage conditions, so it needs many memory and all memory
blocks locked at physical memory. But the program cannot allocate physical
memory more then 64 Mb. Why? When we run testing program under Windows NT,
it shows that we can use 400 Mb (exactly installed at a computer). But under
DOS it always detects only 64 Mb! See the testing program below. Total
number of physical pages is always ~16000, and each peage is 4096 bytes.

Can you help me? We need MORE memory to continue use DJGPP...

Thank you,

Alex

Alexander V. Yeryomin
----------------------------------------------
Project Manager, Senior System Architect
Excelsior  (http://www.Excelsior-USA.com/)




--------- under NT log
largest available free block in bytes     15728640
maximum unlocked page allocation in pages 3840
maximum locked page allocation in pages   2913
linear address space size in pages        524256
total number of unlocked pages            2920
total number of free pages                97802
total number of physical pages            130922
free linear address space in pages        498316
size of paging file partition in pages    189365

Physical memory           = 400588800
Virtual memory            = 15728640
Remaining physical memory = 400580608
Remaining virtual memory  = 15728640
Changes physical memory   = 8192
Changes virtual memory    = 0
---------------






#include <stdio.h>
#include <stdlib.h>
#include <bios.h>
#include <dpmi.h>
#include <crt0.h>
#include <string.h>

#define ONE_MEG 1048576
#define BLOCK   (16*ONE_MEG)



int main ()
{
  _crt0_startup_flags = _crt0_startup_flags | _CRT0_FLAG_LOCK_MEMORY;
  
  char *p = NULL;
  unsigned long phmem;
  unsigned long vrmem;
  unsigned long phmem2;
  unsigned long vrmem2;

  __dpmi_free_mem_info free_mem_info;

  while (1)
  {
    _go32_dpmi_get_free_memory_information (&free_mem_info);
    printf ("largest available free block in bytes     %ld\n",
free_mem_info.largest_available_free_block_in_bytes);
    printf ("maximum unlocked page allocation in pages %ld\n",
free_mem_info.maximum_unlocked_page_allocation_in_pages);
    printf ("maximum locked page allocation in pages   %ld\n",
free_mem_info.maximum_locked_page_allocation_in_pages);
    printf ("linear address space size in pages        %ld\n",
free_mem_info.linear_address_space_size_in_pages);
    printf ("total number of unlocked pages            %ld\n",
free_mem_info.total_number_of_unlocked_pages);
    printf ("total number of free pages                %ld\n",
free_mem_info.total_number_of_free_pages);
    printf ("total number of physical pages            %ld\n",
free_mem_info.total_number_of_physical_pages);
    printf ("free linear address space in pages        %ld\n",
free_mem_info.free_linear_address_space_in_pages);
    printf ("size of paging file partition in pages    %ld\n",
free_mem_info.size_of_paging_file_partition_in_pages);

    phmem = _go32_dpmi_remaining_physical_memory();
    vrmem = _go32_dpmi_remaining_virtual_memory();
    printf ("\nPhysical memory           = %ld\n", phmem);
    printf ("Virtual memory            = %ld\n", vrmem);

    p = malloc (BLOCK);
    if (!p)
      break;

    phmem2 = _go32_dpmi_remaining_physical_memory();
    vrmem2 = _go32_dpmi_remaining_virtual_memory();
    printf ("Remaining physical memory = %ld\n", phmem2);
    printf ("Remaining virtual memory  = %ld\n", vrmem2);

    printf ("Changes physical memory   = %ld\n", phmem - phmem2);
    printf ("Changes virtual memory    = %ld\n\n", vrmem - vrmem2);
    
    while (!bioskey(1));
    bioskey (0);
  }  

  return 0;
}

- Raw text -


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