next up previous contents index
Next: allocate_memory_block Up: Functions and Procedures Previous: create_code_segment_alias_descriptor

get_meminfo

   

Declaration:

Function get_meminfo (var meminfo : tmeminfo) : boolean;

Description:

Returns information about the amount of available physical memory, linear address space, and disk space for page swapping.

Parameters:

meminfo:
buffer to fill memory information into

Return values: Due to an implementation bug this function always returns false, but it always succeeds.

Notes: Only the first field of the returned structure is guaranteed to contain a valid value. Any fields that are not supported by the DPMI host will be set by the host to -1 (0FFFFFFFFH) to indicate that the information is not available. The size of the pages used by the DPMI host can be obtained with the get_page_size function.

Errors:

Check the int31error variable

See also:

get_page_size

Example
Program meminf;

uses go32;

var meminfo : tmeminfo;

begin
get_meminfo(meminfo);
if (int31error <> 0)  then 
 begin
 Writeln('Error getting DPMI memory information... Halting');
 Writeln('DPMI error number : ', int31error);
 end 
else 
 with meminfo do 
   begin
   Writeln('Largest available free block : ', 
           available_memory div 1024, ' kbytes');
   if (available_pages <> -1) then
     Writeln('Maximum available unlocked pages : ', 
              available_pages);
   if (available_lockable_pages <> -1) then
     Writeln('Maximum lockable available pages : ', 
              available_lockable_pages);
   if (linear_space <> -1) then
     Writeln('Linear address space size : ', 
             linear_space*get_page_size div 1024, 
             ' kbytes');
   if (unlocked_pages <> -1) then
     Writeln('Total number of unlocked pages : ', 
             unlocked_pages);
   if (available_physical_pages <> -1) then
     Writeln('Total number of free pages : ', 
             available_physical_pages);
   if (total_physical_pages <> -1) then
     Writeln('Total number of physical pages : ', 
             total_physical_pages);
   if (free_linear_space <> -1) then
     Writeln('Free linear address space : ', 
             free_linear_space*get_page_size div 1024,
             ' kbytes');
   if (max_pages_in_paging_file <> -1) then
     Writeln('Maximum size of paging file : ', 
              max_pages_in_paging_file*get_page_size div 1024, 
              ' kbytes');
  end;
end.



Michael Van Canneyt
Thu Sep 10 13:59:33 CEST 1998