Go to the first, previous, next, last section, table of contents.


_go32_dpmi_get_free_memory_information

Syntax

#include <dpmi.h

int _go32_dpmi_get_free_memory_information(_go32_dpmi_meminfo *info);

Description

This function fills in the following structure:

typedef struct {
  u_long available_memory;
  u_long available_pages;
  u_long available_lockable_pages;
  u_long linear_space;
  u_long unlocked_pages;
  u_long available_physical_pages;
  u_long total_physical_pages;
  u_long free_linear_space;
  u_long max_pages_in_paging_file;
  u_long reserved[3];
} _go32_dpmi_meminfo;

The only field that is guaranteed to have useful data is available_memory. Any unavailable field has -1 in it.

Return Value

Zero on success, nonzero on failure.

Portability

not ANSI, not POSIX

Example

int phys_mem_left()
{
  _go32_dpmi_meminfo info;
  _go32_dpmi_get_free_memory_information(&info);
  if (info.available_physical_pages != -1)
    return info.available_physical_pages * 4096;
  return info.available_memory;
}


Go to the first, previous, next, last section, table of contents.